PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'''
Even Fibonacci # Under 4,000,000 added together
Challenge was get the sum of all even numbers from the fibonacci series below 4 Million.
From: https://projecteuler.net/problem=2
http://leakyegg.website.tk/
'''
a=0
b=1
myList=[]
total=0
for i in range(17):
myList.append(a)
if b<4000000:
myList.append(b)
a=b+a
b=b+a
myList=[i for i in myList if i%2==0]
for i in myList:
total=total+i
print(myList)
print("\nTotal: {}".format(total))
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run