Skip to content

Instantly share code, notes, and snippets.

@accessnash
Created May 19, 2018 21:59
Show Gist options
  • Select an option

  • Save accessnash/f649e6a1edb67aa2f16909fab90425bd to your computer and use it in GitHub Desktop.

Select an option

Save accessnash/f649e6a1edb67aa2f16909fab90425bd to your computer and use it in GitHub Desktop.
sum of even fibonacci numbers less than 4 millions - problem from Project Euler
fiblist = []
a,b=1,2
while b < 8000001:
fiblist.append(a)
a,b = b,a+b
print(fiblist)
newlist = []
for num in fiblist:
if num % 2 ==0:
newlist.append(num)
print(newlist)
print(sum(newlist))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment