Skip to content
Snippets Groups Projects
Unverified Commit 97bc8a3e authored by Bertrand  NÉRON's avatar Bertrand NÉRON
Browse files

fix fibonacci

parent f7903932
No related branches found
No related tags found
No related merge requests found
...@@ -19,12 +19,12 @@ def fibonacci(n): ...@@ -19,12 +19,12 @@ def fibonacci(n):
elif i == 1: elif i == 1:
fib_suite.append(1) fib_suite.append(1)
else: else:
res = fib_suite[i-1] + fib_suite[i-2] res = fib_suite[-1] + fib_suite[-2]
fib_suite.append(res) fib_suite.append(res)
i += 1 i += 1
return fib_suite return fib_suite
print ', '.join([str(i) for i in fibonacci(10)]) print(', '.join([str(i) for i in fibonacci(10)]))
def fibonacci_2(n): def fibonacci_2(n):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment