June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -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)]