mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-12-01 00:41:09 +00:00
Add files via upload
This commit is contained in:
parent
1568432e82
commit
92e0aa29b9
13
Project Euler/Problem 02/sol2.py
Normal file
13
Project Euler/Problem 02/sol2.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
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)
|
Loading…
Reference in New Issue
Block a user