Fibonacci Series in Python Using For Loop

(Last Updated On: 12/12/2022)

Python Program to Find the Fibonacci Series Using for Loop

# Fibonacci Series in Python Using For Loop
# initialize two variables, with value 0
a, b = 0, 1
series_length = 18

print(a, b, end=' ')
for i in range(series_length):
    c = a + b
    print(c, end=' ')
    a = b
    b = c

Output:

0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 

Leave a Reply

Your email address will not be published. Required fields are marked *