I have a problem about making a fibonacci sequence to a list, I\'m just new to python someone help me please.
This is my code. I know this is looking wrong or somet
It is not fast but it works as well:
def fibonacci(n):
# return a list of fibonacci numbers
if n == 0:
fibonacci_list = []
elif n == 1:
fibonacci_list = [0]
elif n == 2:
fibonacci_list = [0, 1]
elif n > 2:
fibonacci_list = [0, 1]
for i in range(n-2):
fibonacci_list += [0]
fibonacci_list[-1] = fibonacci_list[-2] + fibonacci_list[-3]
return fibonacci_list