Even Fibonacci numbers

Note

The following problem was inspired by Problem 2 at Project Euler.

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 0 and 1, the first ten terms will be

0, 1, 1, 2, 3, 5, 8, 13, 21, 34.

Define a function according to the following definition:

even_fibonacci_numbers(n)

Return the sum of all even Fibonacci numbers below n.

Parameters:n (int) – The number up to which the sum of Fibonacci numbers is computed.
Returns:The sum of all Fibonacci numbers up to n.
Return type:int

Start by downloading the exercise template and editing this file. You can run tests via

$ python even_fibonacci_numbers.py test

to check whether you got a correct solution. You can also take a look at one possible solution.