Assignment doubt

nth_term =int(input("Enter the terms : “))
first_number = 1
second_number =1
if nth_term <=9:
print(“The requested series is” ,first_number,second_number,end=” “)
for i in range(2,nth_term):
next=first_number+second_number
print(next,end=” ")
first_number=second_number
second_number=next
else:
print(“The fibonacci series is out of range for above assignment” ,)

output is matching to the series when entered in range of 9(is it enough for assignment part???)
but
wen i enter 0 ,1,2—output is 1,1 only

@thaseenraza1210

Is it beacuse you have given the if condition, if n<=9 than it should print first number and second number.

1 Like