Write a pseudocode a function called fibonacci that determines the first n terms of the Fibonacci sequence. The function should take n as an argument and return a list of the first n terms of the Fibonacci sequence.
1
Expert's answer
2021-05-24T07:42:50-0400
def fib(n:int):
a = list()
for i in range(n):
if i < 2:
a.append(1)
else:
a.append(a[-1]+a[-2])
print(a[i], end=' ')
fib(int(input()))
Comments
Leave a comment