Skip Unlucky Thirteen
Imagine that the number 13 ruins the calculation, and the number right after it must be skipped too. Write a function sum13 that takes a list nums and returns the sum of the allowed numbers. Whenever you see 13, do not add it or the next element.
Примеры
Ввод
[1, 2, 2, 1]Вывод
6Ввод
[1, 1]Вывод
2Ввод
[13, 1, 2, 13, 2, 1, 13]Вывод
3Нужно реализовать
def sum13(nums: list[int]) -> int:
Теги
listsarray
Log ind for at se indsendelseshistorik
Log indLog ind for at bruge AI-mentor
Log indVisible tests
1
Input
[1,2,2,1]Expected
62
Input
[1,1]Expected
23
Input
[13,1,2,13,2,1,13]Expected
34
Input
[]Expected
05
Input
[13]Expected
06
Input
[13,13]Expected
0Focus radio
Paused · SomaFM · Fluid