Fokoel
6/7/2019 - 1:21 PM

Project Euler - 2. Четные числа Фибоначчи

final_sum = 0
f_arr = []
a, b = 0, 1

while a < 4000000:
    f_arr.append(a)
    a, b = b, a + b

for i in f_arr:
    if i % 2 == 0:
        final_sum += i

print(f'Fibonacci sum is {final_sum}')