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
PostgreSQLv16

Siia ilmub koodi käivituse tulemus

Visible tests
1
Input
10
Expected10
2
Input
100
Expected44
3
Input
4000000
Expected4613732
4
Input
1
Expected0
5
Input
8
Expected10
6
Input
34
Expected44
Focus radio
Paused · SomaFM · Fluid