In [1]:
#/usr/bin/env python3

def main():
    ############################
    #                          #
    #  Variable Declarations   #
    #                          #
    ############################
    fibOne = 0 #First Value in the sequence
    fibTwo = 1 #second value in the sequence
    fibOneList = [] #Blank array that will hold all of the values
    fibTerms = int(input("Enter an integer => ")) #an input that will define the length of the sequance

    ############################
    #                          #
    #   while loop procedure   #
    #                          #
    ############################
    for count in range(0, fibTerms):  
    #for loop starts at zero and continues until inputted item is reached  
       fibOneList.append(fibOne) #fibOne gets added to list
       holder = fibOne + fibTwo  #holder variable is created and sums fibOne and fibTwo
       fibOne = fibTwo #fibOne takes the value of fibTwo
       fibTwo = holder #fibTwo take the value of fibOne
       count += 1 #The value of count is increased by one
        
    print("here is a fibonacci sequence of {} numbers starting at 0".format(fibTerms))
    print( ", ".join(repr(item) for item in fibOneList )) 
    #I print out the array in a readable format, by printing each value in
    #the array, and joining it as a single string.  It uses the .join()
    #method. and the repr() built in function.  repr() takes data and puts it 
    #in a readable format. The for loop inside the repr function goes through 
    #each item of the list that was created. 
    
    endgame() #I call the endgame function
        
def endgame():
    print("Go again? Y or N") 
    answer = input("==> ") #input asking to go again.
    if answer == "Y" or answer == "y": # if yes I rerun the main() function
        main()
    elif answer == "N" or answer == "n": #if no I print have a nice day and leave
        print("have a nice day")
    else:  #if it's not a 'y', 'Y', 'n', or 'N' I rerun the function
        endgame()

main() #I start the program withe the main function
Enter an integer => 20
here is a fibonacci sequence of 20 numbers starting at 0
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181
Go again? Y or N
==> y
Enter an integer => 50
here is a fibonacci sequence of 50 numbers starting at 0
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 267914296, 433494437, 701408733, 1134903170, 1836311903, 2971215073, 4807526976, 7778742049
Go again? Y or N
==> n
have a nice day
In [ ]: