fib = [1,2] i = 0 while fib[-1] < 4000000: fib.append(fib[i]+fib[i+1]) i += 1 sums = 0 for n in fib: if n % 2 == 0: sums += n print(sums)