Even Fibonacci Sum
The Fibonacci sequence is a classic first exercise for practicing loops and building up a total. Write a function even_fibonacci_sum that looks at the Fibonacci numbers 1, 2, 3, 5, 8, and so on, not exceeding limit. Add only the even terms of the sequence. Return the resulting sum.
Примеры
Ввод
10Вывод
10Ввод
100Вывод
44Ввод
4000000Вывод
4613732Нужно реализовать
def even_fibonacci_sum(limit: int) -> int:
Теги
math
Conectează-te pentru a vedea istoricul soluțiilor trimise
Conectează-teConectează-te pentru a folosi Mentorul AI
Conectează-teVisible tests
1
Input
10Expected
102
Input
100Expected
443
Input
4000000Expected
46137324
Input
1Expected
05
Input
8Expected
106
Input
34Expected
44Focus radio
Paused · SomaFM · Fluid