Filtered Fibonacci with ifilter
itertools ifilter
from series import fibonacci
from itertools import ifilter
even = ifilter( lambda f: f % 2 == 0, fibonacci() )
for e in even:
print(e)
if e > 200:
break
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
itertools ifilter
from series import fibonacci
from itertools import ifilter
even = ifilter( lambda f: f % 2 == 0, fibonacci() )
for e in even:
print(e)
if e > 200:
break