Generate Fibonacci Series in Python || Generators || Python

In this we are going to see how to Generate Fibonacci Series in Python, using Generators in Python Programming Language.


def fib(limit):
    a, b = 0, 1
    while a < limit:
        yield a
        a, b = b, a + b

print("\nUsing for in loop")
for i in fib(10):
    print(i)

# Coded By Dhiraj Shelke

#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post