How do I print a fibonacci sequence to the nth number in Python?
问题 I have a homework assignment that I'm stumped on. I'm trying to write a program that outputs the fibonacci sequence up the nth number. Here's what I have so far: def fib(): n = int(input("Please Enter a number: ")) if n == 1: return(1) elif n == 0: return(0) else: return (n-1) + (n-2) mylist = range[0:n] print(mylist) I'm thinking I could use separate functions but I can't figure out how to pass the argument that calculates the fibonacci sequence. Then the next step would be to to print out