diff --git a/Project Euler/Problem 02/sol2.py b/Project Euler/Problem 02/sol2.py new file mode 100644 index 000000000..f0502a389 --- /dev/null +++ b/Project Euler/Problem 02/sol2.py @@ -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)