Even Counter

Even numbers often need to be found quickly, such as when choosing every second item or checking a set of values. Write a function count_evens that takes a list nums and counts how many even numbers it contains. Return that count as an integer.

Примеры

Ввод
[2, 1, 2, 3, 4]
Вывод
3
Ввод
[2, 2, 0]
Вывод
3
Ввод
[1, 3, 5]
Вывод
0

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

def count_evens(nums: list[int]) -> int:

Теги

listsarray
PostgreSQLv16

Čia bus kodo vykdymo rezultatas

Visible tests
1
Input
[2,1,2,3,4]
Expected3
2
Input
[2,2,0]
Expected3
3
Input
[1,3,5]
Expected0
4
Input
[]
Expected0
5
Input
[7,8,9,10]
Expected2
6
Input
[2]
Expected1
Focus radio
Paused · SomaFM · Fluid