"""Find the sum of even Fibonacci numbers less than 4,000,000"""deffibonacci(cap):"""Generates fibonacci numbers less than cap"""a,b,c=0,1,1whilec<cap:yieldca,b=b,cc=a+bdefeven_fib_sum(cap):"""Returns the sum of even fibonacci numbers less than cap"""returnsum(fibforfibinfibonacci(cap)iffib%2==0)if__name__=="__main__":print(even_fib_sum(4000000))print(list(fibonacci(4000000))# => 4613732# => [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578]

## re: Project Euler #2 - Even Fibonacci numbers VIEW POST

FULL DISCUSSION4,613,732! :D