Count the Sheep

In this list of marks, True means a sheep is present and False means it is missing. Write count_sheeps, which counts how many True values are in the list arr. If the list is empty or all values are False, the result should be 0.

Примеры

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

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

def count_sheeps(arr: list[bool]) -> int:

Теги

array
PostgreSQLv16

Hier verschijnt het resultaat van je code

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