Python FIBONACCI SERIES with example


Find FIBONACCI SERIES in Python


def fibonacci_ser(num):
a=0 b=1 if num == 1:
print(a)
elif num == 2 :
print(a, b)
else:
print(a,b,end=" ")
for i in range(num-2):
c=a+b
a=b
b=c
print(b,end=" ")
num=int(input("enter number to find Fabonacci series: "))
print(fibonacci_ser(num))

Python FIBONACCI SERIES with example

Leave a Comment

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