Python/Project Euler/Problem 02/sol2.py

14 lines
231 B
Python
Raw Normal View History

2018-01-21 08:34:09 +00:00
def fib(n):
ls = []
a,b = 0,1
n += 1
for i in range(n):
if (b % 2 == 0):
ls.append(b)
else:
pass
a,b = b, a+b
print (sum(ls))
return None
fib(10)