SHARE
TWEET

Untitled

a guest Sep 15th, 2019 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def fibonacci_generator(limit=4e6):
  2.     n1 = 1
  3.     yield n1
  4.     n2 = 1
  5.     yield n2
  6.  
  7.     while n2 <= limit:
  8.         n2 += n1
  9.         n1 = n2 - n1
  10.         yield n2
  11.  
  12.  
  13. print(sum(i for i in fibonacci_generator() if i % 2 == 0))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top