Question: debug def get_num(): #prompt user for a number n = input('Which Fibonacci number would you like to see? ') #Negetive numbers are not accepted. assert

debug

def get_num():

#prompt user for a number

n = input('Which Fibonacci number would you like to see? ')

#Negetive numbers are not accepted.

assert n.isnumeric(), "Number has to be positive! "

return int(n)

def fib_bottom_up(n):

if n == 1 or n == 2:

return 1

bottom_up = [None] * (n+1)

bottom_up[0] = 1

bottom_up[1] = 1

for i in range(2,n+1):

bottom_up[i] = bottom_up[i-1] + bottom_up[i-2]

print(f"Fibonacci number {n} is {bottom_up[n]}.")

output:

Which Fibonacci number would you like to see? 7 Fibonacci number 7 is 21. None

How can i remove the "None" from output?

n = get_num()

print(fib_bottom_up(n))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!