mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-24 13:31:07 +00:00
14 lines
231 B
Python
14 lines
231 B
Python
|
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)
|