Problem 2

This commit is contained in:
Dece 2019-12-29 02:57:17 +01:00
parent ae41caa19d
commit 5b51f10563

9
problem2.py Normal file
View file

@ -0,0 +1,9 @@
def fib(limit=None):
a, b = 1, 2
yield a
yield b
while (not limit or a + b < limit):
a, b = b, a + b
yield b
print(sum(n for n in fib(4_000_000) if n % 2 == 0))