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

trsform code of fibonacci in function

parent bb486f29
No related branches found
No related tags found
No related merge requests found
fib_suite = [] def fibonacci(n):
n = 0 fib_suite = []
while n < 10: i = 0
if n == 0: while i <= n:
fib_suite.append(0) if i == 0:
elif n == 1: fib_suite.append(0)
fib_suite.append(1) elif i == 1:
else: fib_suite.append(1)
res = fib_suite[n-1] + fib_suite[n-2] else:
fib_suite.append(res) res = fib_suite[i-1] + fib_suite[i-2]
n += 1 fib_suite.append(res)
print ', '.join([str(i) for i in fib_suite]) i += 1
\ No newline at end of file return fib_suite
print ', '.join([str(i) for i in fibonacci(10)])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment