Question: Using Python This is a previous program using sequence. I need a program using recursion, without while or for loops. Assignment 02: M04 Creating a

Using Python  Using Python This is a previous program using sequence. I need
a program using recursion, without while or for loops. Assignment 02: M04
This is a previous program using sequence. I need a program using recursion, without while or for loops.
Creating a Sequence Using Recursion: NOTE: Make sure and include comments in

Assignment 02: M04 Creating a Sequence Using Recursion: NOTE: Make sure and include comments in your program. At a minimum it should include the author's name and a short program description. You will lose points if you have no comments. For this assignment, I would like for you to rewrite the code from the Creating a Sequence Using Functions from CSC 1613 so that it uses recursion (No While Loops or For Loops) for the following sequences: 1. Square Numbers 2. Fibonacci Numbers 3. Triangular Numbers 4. Hexagonal Numbers (New) Also for this program, allow the user to: State which list to create State how many elements that they want in the list Allow the user to state the number that starts generating the Square Numbers and Triangular Numbers. IISL Allow the user to state the number that starts generating the Square Numbers and Triangular Numbers. Allow the user to decide if they would like to create a new sequence. Be sure to include comments with at least your name, and a brief description of the code. Below is the example run of the program. Sample Runs: which sequence? (S,F,T) S how long is the list? 5 what is the startng number? O [0, 1, 4, 9, 16) Would you like to run this program again? (Y or N) Y which sequence? (S,F,I) F how long is the list? 5 [0, 1, 1, 2, 3] Would you like to run this program again? (Y or N) Y which sequence? (S,FT) T how long is the list? 5 what is the starting number 1 [1.0, 3.0, 6.0, 10.0, 15.0] Would you like to run this program again? (Y or N) To submit this assignment, please click Assignment 02: M04 Creating a Sequence Using Recursion. (Programs: 100 pts) which list to create, how many elements that they want, and generates the numbers." cont= "Y" while cont== "Y": mylist=0 seq = input('which input?(S,FT)' seq = seq.lower() length = int(input("Length of list?")) if seq == "S": #inputs Square Numbers start = int(input('what is the starting number?')); for x in range(start, start+length): y=x**2 mylist.append(y) print(mylist) elif seq =="t": #inputs Triangular Numbers start = int(input('what is the starting number?')) for x in range(start, start+length): y=x*(x + 1)/2 mylist.append(y) print(mylist) elif seq == "f": #inputs Fibonacci Numbers x1=0 x2=1 mylist.append(x1) mylist.append(x2) for x in ranage(0, length+2): Fib = x1+x2 x1=x2 X2=Fib mylist.append(Fib) print(mylist) #prints the list cont=input("Would you like to make a new list? (Y or N)") #prints another list cont=cont.upper() print("Thank You") #prints ending

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!