+ 1

Please check my code in description:

#what is the error in this code ?? I wanna make fibonacci series. num = int(input()) def fibonacci(n): for i in range(n+1): print(i) temp = i res += temp print(res) fibonacci(num) #output should be like : 0 1 1 2 3 5 8 13 ...

6th Nov 2020, 2:41 PM
Naseem Ullah
Naseem Ullah - avatar
2 Réponses
0
To start you have to set res in fibonacci function (to 0 I assume)
6th Nov 2020, 3:16 PM
Benjamin Jürgens
Benjamin Jürgens - avatar
0
Instead of fibonacci you generate triangular numbers (ignoring output from print(i))
6th Nov 2020, 3:21 PM
Benjamin Jürgens
Benjamin Jürgens - avatar