def evenFibonacciNumbers():
    fib=1
    fib2=2
    temp=0
    sum=0

    while temp<4000000:
        temp =fib2

        if temp %2 == 0:
            sum =sum+temp

        temp= fib+fib2
        fib=fib2
        fib2=temp

    return sum

print("\nIf we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9.\n"
      "The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000.\n")

print(sum(x for x in range(1, 1000) if x%3==0 or x%5==0))

print("\nEach new term in the Fibonacci sequence is generated by adding the previous two terms."
      "\nBy starting with 1 and 2, the first 10 terms will be:"
      "\n1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ..."
      "\nBy considering the terms in the Fibonacci sequence whose values do not exceed four million,"
      "\nfind the sum of the even-valued terms.")

print(evenFibonacciNumbers())
Add existing file