Question: nterms = int ( input ( How many terms? ) ) # first two terms n 1 , n 2 = 0 ,
nterms intinputHow many terms?
# first two terms
n n
count
# check if the number of terms is valid
if nterms :
printPlease enter a positive integer"
# if there is only one term, return n
elif nterms :
printFibonacci sequence upto",nterms,":"
printn
# generate fibonacci sequence
else:
printFibonacci sequence:"
while count nterms:
printn
nth n
# update values
n n
#correction is here
n nthn
count
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
