+ 1
help about code project about functions
The 3 first test cases are correct, but the 2 last not. here is the code: ``` num = int(input()) fib = [0,1,1,2,3,5,8,13,21,34] def fibonacci(n): while n>0: print(fib.pop(0)) n -= 1 fibonacci(num) ```
2 ответов
+ 4
[Edited]
KonstTheoGR ,
as already mentioned from Abhay, you should not "hard-code" the numbers of the fibonacci series. to solve the exercice you can use:
=> recursion ( if you feel familiar with this )
or
=> a while loop with a counter variable
or
=> for loop with range()
the task is from "python core", functional programming, lesson nr 70
+ 3
I don't know what is the lesson name and course name , so i will guess it is because you are manually providing a series of numbers . This is not how you solve a problem.