Stop at Thirteen
Here, the number 13 works like a stop signal: everything after it no longer counts. Write a function lucky_sum that takes three numbers a, b, and c. Add the numbers from left to right, but if you meet 13, skip it and all values after it.
Примеры
Ввод
1, 2, 3Вывод
6Ввод
1, 2, 13Вывод
3Ввод
1, 13, 3Вывод
1Нужно реализовать
def lucky_sum(a: int, b: int, c: int) -> int:
Теги
math
Logga in för att se historik över inskick
Logga inLogga in för att använda AI-mentorn
Logga inVisible tests
1
Input
1, 2, 3Expected
62
Input
1, 2, 13Expected
33
Input
1, 13, 3Expected
14
Input
13, 2, 3Expected
05
Input
13, 13, 2Expected
06
Input
9, 4, 13Expected
13Focus radio
Paused · SomaFM · Fluid