mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08: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)
|