Skip to content

Instantly share code, notes, and snippets.

@Ahmed-Fawzy
Created May 5, 2014 02:10
Show Gist options
  • Save Ahmed-Fawzy/8f166b29974c9532325b to your computer and use it in GitHub Desktop.
Save Ahmed-Fawzy/8f166b29974c9532325b to your computer and use it in GitHub Desktop.
Project Euler - Problem 2
#!/usr/bin/python
End = 4000000
Sum = 2
back = 1
current = 2
def is_even(n):
return n % 2 == 0
while True :
num = back + current
if num < End :
if is_even(num) == True :
Sum += num
else:
break
back = current
current = num
print Sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment