Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python fibonacci generator

def fib(num):
    a = 0
    b = 1
    for i in range(num):
        yield a
        a, b = b, a + b # Adds values together then swaps them

for x in fib(100):
    print(x)
 
PREVIOUS NEXT
Tagged: #python #fibonacci #generator
ADD COMMENT
Topic
Name
5+8 =