+ 1

Write a program using list comprehension to print the Fibonacci sequence in comma separated form with a given n input by console

n=int(input()) mylist=[0,1] mylist=[mylist. append(mylist[-2]+[-1]) for n in range(n)] print(mylist)

28th Dec 2021, 1:23 AM
Stevewa
Stevewa - avatar
4 Respostas
+ 1
n=int(input()) mylist=[0,1] mylist=[mylist. append(mylist[-2]+[-1]) for n in range(n)] print(mylist).
28th Dec 2021, 1:49 AM
Stevewa
Stevewa - avatar
0
This is my assignment. I don't know how to solve this! 😅
28th Dec 2021, 1:43 AM
Stevewa
Stevewa - avatar