Fibonacci Series – Python Lab Program

This is a simple program to print the Fibonacci series up to the number that the user entered.

#Python program to generate Fibonacci series until 'n' value
n = int(input("Enter the number of terms: "))
a = 0
b = 1
sum = 0
count = 1
print("Fibonacci Series: ")
while(count <= n):
print(sum)
count += 1
a = b
b = sum
sum = a + b

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.