MCPcopy Create free account
hub / github.com/leaningtech/webvm / fib

Function fib

examples/python3/fibonacci.py:1–5  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1def fib():
2 a, b = 0, 1
3 while True: # First iteration:
4 yield a # yield 0 to start with and then
5 a, b = b, a + b # a will now be 1, and b will also be 1, (0 + 1)
6
7for index, fibonacci_number in zip(range(100), fib()):
8 print('{i:3}: {f:3}'.format(i=index, f=fibonacci_number))

Callers 1

fibonacci.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected