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
Přihlaste se, abyste viděli historii odevzdání
Přihlásit sePřihlaste se, abyste mohli použít AI mentora
Přihlásit seTests12
Visible tests
Skrytý test 7
Skrytý test 8
Skrytý test 9
Skrytý test 10
Skrytý test 11
Skrytý test 12
They run when you press "Submit" — your whole solution is checked against them so you can't hard-code answers for the visible cases.
Focus radio
Paused · SomaFM · Fluid