Skip to content

Instantly share code, notes, and snippets.

@cuihaoleo
Created Sep 28, 2014
Embed
What would you like to do?
def fib (m):
a, b, c = 0, 1, 1
yield 1
while a+b <= m:
c = a + b
yield c
a, b= b, c
s = 0
for i in fib(4000000):
if i%2 == 0:
s += i
print s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment