a=0 b=1 count=0 #Check if the number entered is valid or not if num<=0: print("pls enter a positve number") #if there is single term elif num==1: print("fibonacci series upto ",num,' is ',a,end='') #fibonacci sequence else: while count<num: print(a) c=a+b #upadating the values a=b b=c count+=1