June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -1,11 +1,10 @@
|
|||
from itertools import islice
|
||||
|
||||
def fib():
|
||||
yield 0
|
||||
yield 1
|
||||
a, b = fib(), fib()
|
||||
next(b)
|
||||
"""Yield fib[n+1] + fib[n]"""
|
||||
yield 1 # have to start somewhere
|
||||
lhs, rhs = fib(), fib()
|
||||
yield next(lhs) # move lhs one iteration ahead
|
||||
while True:
|
||||
yield next(a)+next(b)
|
||||
yield next(lhs)+next(rhs)
|
||||
|
||||
print(tuple(islice(fib(), 10)))
|
||||
f=fib()
|
||||
print [next(f) for _ in range(9)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue