Program - fibonaaci using generator


Topic: Program - fibonaaci using generator

Solution

def fibo(n):
    x = 0
    yield x
    y = 1
    yield y
    for i in range(n-1):
        x, y = y, x+y
        yield y



List all Python Programs