Skip to content

Instantly share code, notes, and snippets.

@iizukak
Created July 14, 2012 12:17
Show Gist options
  • Select an option

  • Save iizukak/3110931 to your computer and use it in GitHub Desktop.

Select an option

Save iizukak/3110931 to your computer and use it in GitHub Desktop.
project euler problem 2
a = [1, 2]
b = 0
while True:
b = a[-1] + a[-2]
if b > 4000000:
break
a.append(b)
c = [i for i in a if i % 2 == 0]
print(sum(c))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment