0

I want to create a Fibonacci series but i don't know why my code is not working.So please help me to fix it.

Here is the code:: def fibonacci(series): lst1=[0,1] lst1.append(series) for char in lst1: length=len(lst1) ind1=length-1 ind2=ind1-1 final_num=lst1(ind1)+lst1(ind2) lst1.append(final_num) return lst1 print(fibonacci(2))

31st Dec 2021, 2:53 PM
Vaibhav Tiwari
2 Respuestas
+ 5
Hey See the error u getting is because you are treating list as function That ind1 and ind2 should be in [] not in () Even after that your code have couple of logic issues this should resolve all issues https://code.sololearn.com/ce20Mq5J7qDQ/?ref=app
31st Dec 2021, 4:25 PM
Atul
Atul - avatar
+ 1
You are awesome 😎 bro thankyou so much
1st Jan 2022, 5:25 AM
Vaibhav Tiwari