In [12]:
a, b = 1, 1
s = 0
while True:
if b > 4000000:
break
if b%2 == 0:
print b
s = s+b
a, b = b, a+b
print s
In [17]:
a, b = 1, 1
total = 0
while b < 4000000:
if b % 2 == 0:
print b
total = total +b
a, b = b, a+b
print total
In [ ]:
1*2*3*4*5*6*7*