Jun-10-2020, 02:14 PM
Use an infinite generator together with
Generators: https://realpython.com/introduction-to-p...enerators/
Islice: https://docs.python.org/3/library/iterto...ols.islice
itertools.islice
.from itertools import islice def fib(): a, b = 0, 1 while True: yield a a, b = a + b, a fibs = list(islice(fib(), 0, 100))The yield in the function turns the function into a generator.
Generators: https://realpython.com/introduction-to-p...enerators/
Islice: https://docs.python.org/3/library/iterto...ols.islice
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!