Need help on Python 3 Module 7 Project | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Need help on Python 3 Module 7 Project

Hi, I'm having trouble with the Fibonacci project. My code is below, but it doesn't return what I want at all. If you could give me some advice for how to fix this or a different strategy I should try, that would be great. num = int(input()) fibs = [i for i in range (num)] def fibonacci(n, x): if x < n: if x == 0: print(0) elif x == 1: print(1) else: fibs[x] = (fibs[(n-1)] + fibs[(n-2)]) print(fibs[x]) return fibonacci(n-1, x+1) fibonacci(num, 0)

13th Jan 2021, 7:06 PM
Alex
Alex - avatar
2 Answers
0
What is fibs?
13th Jan 2021, 9:40 PM
Václav Dostál
Václav Dostál - avatar
0
Thanks Abol! That answer was very close to correct, and I was able to figure it out.
14th Jan 2021, 8:44 PM
Alex
Alex - avatar