True Counter

Lists often store the results of checks: a test passed, a setting is enabled, or a match was found. Write a function count_truthy that takes a list arr of boolean values. Return how many times True appears in the list.

Примеры

Ввод
[True, False, True, True]
Вывод
3
Ввод
[]
Вывод
0
Ввод
[False, False, False]
Вывод
0

Нужно реализовать

def count_truthy(arr: list) -> int:

Теги

listsarraymath
PostgreSQLv16

Le résultat de l'exécution du code s'affichera ici

Visible tests
1
Input
[true,false,true,true]
Expected3
2
Input
[]
Expected0
3
Input
[false,false,false]
Expected0
4
Input
[true]
Expected1
5
Input
[true,true,false,true,false]
Expected3
6
Input
[true,true,false,true]
Expected3
Focus radio
Paused · SomaFM · Fluid