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
PostgreSQLv16

Tutaj pojawi się wynik wykonania kodu

Visible tests
1
Input
[1,2,2,1]
Expected6
2
Input
[1,1]
Expected2
3
Input
[13,1,2,13,2,1,13]
Expected3
4
Input
[]
Expected0
5
Input
[13]
Expected0
6
Input
[13,13]
Expected0
Focus radio
Paused · SomaFM · Fluid