Created
November 30, 2014 21:58
-
-
Save ebartrum/76e85c18519434e9f2c0 to your computer and use it in GitHub Desktop.
A solution to the 2nd Euler Challenge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""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