the-honk/euler/_pythonarchive/2 - Even Fibonacci numbers.py
2021-10-29 01:00:43 +01:00

13 lines
229 B
Python

sequence = [1, 2]
while sequence[len(sequence) - 1] < 4000000:
sequence.append(sequence[len(sequence) - 1] + sequence[len(sequence) - 2])
sequence.pop()
total = 0
for i in sequence:
if i % 2 == 0:
total += i
print(total)