Pls help me to solve fibonacci in python. I tried but didn't succeeded. This is really tough. Python is becoming interesting. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Pls help me to solve fibonacci in python. I tried but didn't succeeded. This is really tough. Python is becoming interesting.

num = int(input()) from itertools import count for n in count(0) : if count(n) == num : break def fibonacci(n): if n <= 1 : return 1 else : return n + fibonacci(n) print (fibonacci(num))

15th May 2021, 1:21 PM
Ritesh Behera
Ritesh Behera - avatar
2 Answers
15th May 2021, 1:33 PM
Sâñtôsh
Sâñtôsh - avatar
0
return fibonacci(n-1) + fibonacci(n-2)
15th May 2021, 1:31 PM
YUGRAJ