+ 1

Can some one help me with the code coach problem Fibonacci? i understand the pattern but can't code it

6 == is the range It should output this: 011,2,3,5

9th Oct 2022, 1:05 PM
Emmanuel Odukoya
Emmanuel Odukoya - avatar
3 Respuestas
+ 1
Firstly, did you tried to solve it? If so, why is not working, can you spot the error? If so, can you fix it? Normally when you ask a question you should always put the problem you are facing and if you know why, also ask how can you fix it. To solve this problem you can think like you were calculating in real life: before:0 now:1. before: 1 result:1. now: 1. before: 1 result: 2. now: 2. before:2 result: 3. now:3 result:5 I hope I helped and Keep the good coding :)
10th Oct 2022, 8:03 AM
Tomás Ribeiro
Tomás Ribeiro - avatar
0
Good speech
10th Oct 2022, 1:51 PM
Emmanuel Odukoya
Emmanuel Odukoya - avatar
0
Tomás Ribeiro Thanks for your motivation, i already did got how to do it on math but since i read what u wrote if gave me more idea to do it my way. Thanks Here the code: num = int(input()) def fibonacci(n): #complete the recursive function fib=[] for i in range(n): if i < 2: fib.append(i) elif i >= 2: fib.append(fib[-1]+fib[-2]) for i in fib: print(i) fibonacci(num)
10th Oct 2022, 6:54 PM
Emmanuel Odukoya
Emmanuel Odukoya - avatar