0
Why my code is working?
num = int(input()) def fibonacci(n): #complete the recursive function if n<=1: return n else : return fibonacci (n-1)+ fibonacci (n-2) for i in range (num): print (fibonacci (num)) This code show error in line number 11 num understand it
3 Answers
+ 3
JAVID KHAN
Learn about how to indent python code
https://code.sololearn.com/c2Uy2e5QHYGI/?ref=app
https://code.sololearn.com/cT5BRIbkia21/?ref=app
+ 1
JAVID KHAN
Working or not working?
Should be
fibonacci(i) instead of fibonacci (num)
--------------------
num = int(input())
def fibonacci(n):
#complete the recursive function
if n <= 1:
return n
else:
return fibonacci (n - 1) + fibonacci (n - 2)
for i in range (num):
print (fibonacci (i))
+ 1
Indentation error in line number 11 and I will do Fibonacci (I) but not working