v = int(input("Please enter N: ")) sum = 0 f1 = 1 f2 = 2 while f2 < v: if f2 % 2 == 0 : sum = sum + f2 f1,f2 = f2, f1+f2 #tmp = f2 #f2 = f1 + f2 #f1 = tmp print("The sum of the even-valued Fibonacci numbers less than ", v, " is ", sum)