Skip to content

Instantly share code, notes, and snippets.

@ebartrum
Created November 30, 2014 21:58
Show Gist options
  • Save ebartrum/76e85c18519434e9f2c0 to your computer and use it in GitHub Desktop.
Save ebartrum/76e85c18519434e9f2c0 to your computer and use it in GitHub Desktop.
A solution to the 2nd Euler Challenge
"""By considering the terms in the Fibonacci sequence
whose values do not exceed four million, find the sum of the even-valued terms."""
array=[1,2]
sum=0
x=1
y=2
while y<4000000:
z=x+y
x=y
y=z
array.append(y)
for e in array:
if e%(2)==0:
sum+=e
print(sum)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment