Even Number Sum

Given a list of integers nums, choose only the even numbers and add them together. If there are no even numbers, or if the list is empty, the sum is 0. Return the final total.

Примеры

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

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

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

Теги

listsmath
PostgreSQLv16

Taispeánfar toradh do chóid anseo

Visible tests
1
Input
[1,2,3,4,5,6]
Expected12
2
Input
[1,3,5]
Expected0
3
Input
[]
Expected0
4
Input
[2,3,4,5,6,7]
Expected12
5
Input
[0,0,0,0,0,0]
Expected0
6
Input
[1,2,3,4,5,6,1,2]
Expected14
Focus radio
Paused · SomaFM · Fluid