# Project Euler: Problem 2: Even Fibonacci Numbers
# Each new term in the Fibonacci sequence is generated by adding the previous
# two terms.By starting with 1 and 2, the first 10 terms will be:
#
# 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
# By considering the terms in the Fibonacci sequence that do not exceed the nth
# term,find the sum of the even-valued terms.


def evenFibSum(limit):
    sumOfEvenValuedTerms = 0
    term1, term2 = 0, 1
    for _ in range(limit):
        term1, term2 = term2, term1 + term2
        if term2 % 2 == 0:
            sumOfEvenValuedTerms += term2
    return sumOfEvenValuedTerms


lim = int(input("Enter Limit to get even fibonacci sum: "))
print(evenFibSum(lim))

b7b7c6b36abc714924a3488eb00916d2c2013a43
<mask token>

def evenFibSum(limit):
    sumOfEvenValuedTerms = 0
    term1, term2 = 0, 1
    for _ in range(limit):
        term1, term2 = term2, term1 + term2
        if term2 % 2 == 0:
            sumOfEvenValuedTerms += term2
    return sumOfEvenValuedTerms


<mask token>

def evenFibSum(limit):
    sumOfEvenValuedTerms = 0
    term1, term2 = 0, 1
    for _ in range(limit):
        term1, term2 = term2, term1 + term2
        if term2 % 2 == 0:
            sumOfEvenValuedTerms += term2
    return sumOfEvenValuedTerms


<mask token>
print(evenFibSum(lim))

def evenFibSum(limit):
    sumOfEvenValuedTerms = 0
    term1, term2 = 0, 1
    for _ in range(limit):
        term1, term2 = term2, term1 + term2
        if term2 % 2 == 0:
            sumOfEvenValuedTerms += term2
    return sumOfEvenValuedTerms


lim = int(input('Enter Limit to get even fibonacci sum: '))
print(evenFibSum(lim))

# Project Euler: Problem 2: Even Fibonacci Numbers
# Each new term in the Fibonacci sequence is generated by adding the previous
# two terms.By starting with 1 and 2, the first 10 terms will be:
#
# 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
# By considering the terms in the Fibonacci sequence that do not exceed the nth
# term,find the sum of the even-valued terms.


def evenFibSum(limit):
    sumOfEvenValuedTerms = 0
    term1, term2 = 0, 1
    for _ in range(limit):
        term1, term2 = term2, term1 + term2
        if term2 % 2 == 0:
            sumOfEvenValuedTerms += term2
    return sumOfEvenValuedTerms


lim = int(input("Enter Limit to get even fibonacci sum: "))
print(evenFibSum(lim))
