Question: NEED IN PYTHON - - files to be Submitted: In this assignment, students should create two Python classes called Recursive.py , RecursiveDemo.py . After the

NEED IN PYTHON -- files to be Submitted:
In this assignment, students should create two Python classes called
Recursive.py,
RecursiveDemo.py. After the assignment has been completed, both files should be submitted for grading into the Dropbox for Assignment 8, which can be found in the Dropbox menu on the course website.
The purpose of the assignment is to practice recursive writing methods. We will write four methods each worth 15 points.
a-def sum_sqr_rec(stk):
which will receive a stack of numbers and output the sum of the squares of the elements in the stack.
b-def plus_minus_rec(stk):
which will receive a stack of numbers (example: {1,2,3,4,5,6,7,8,9,10}) and output the sum of the elements in the stack as follows:
1-2+3-4+5-6+7-8+9-10
c-def prt_chars_rev_rec(stk1)
which will receive a stack of characters and print its elements in reverse.
d-def prt_chars_rec(queue): which will receive a queue of characters and print its elements
Remember to use the stack and queue provided by the Python Library.
The Assignment will require you to create 2 files:
Recursive.py which contains the details of creating the 4 methods as specified above:
def sum_sqr_rec(stk): (15 points)
def plus_minus_rec(stk): (15 points)
def prt_chars_rev_rec(stk1): (15 points)
def prt_chars_rec(queue): (15 points)
RecursiveDemo.py which:
A-reads an expression:
{(1+2)+[4**(2+3)]}
and store the expression in a stack and a queue.(15 points)
a- prints the corresponding expression "in reverse" using: prt_chars_rev_rec (5 points)
b-prints the corresponding expressing "as is" using: prt_chars_rec.(5 points)
B- reads an array as follows: {1,2,3,4,5,6,7,8,9,10}
and store them in a stack.(5 points)
Then it:
C- prints the sum of the squares of the elements in the stack using int sum_sqr_rec(stk) and outputting the value(5 points):
385
D-prints the sum of the elements in the stack using:
def plus_minus_rec(stk): and outputting the value(5 points):
1-2+3-4+5-6+7-8+9-10=-5
Do not forget to drop the 2 files in the dropbox of Assignment8.
NEED IN PYTHON - - files to be Submitted: In this

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 Programming Questions!