Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python fix reverse.py to pass reverse_test.py LI reverse.py 1 from Queue import Queue from Stack import Stack 3 N 3 4 5 6 LO 7

python

image text in transcribedimage text in transcribed

fix reverse.py to pass reverse_test.py

LI reverse.py 1 from Queue import Queue from Stack import Stack 3 N 3 4 5 6 LO 7 # Return a new queue in reverse order # Hint: can use a stack to help def reverse(q_orig): q_new = Queue ([]) return q_new 00 9 10 11 12 13 def main(): q = Queue (list(range(1, 5))) q.print() print("reverse: ", end="") reverse(q).print() 14 15 16 17 18 # Don't run main on import if _name _main__": main() 19 LI N 00 reverse_test.py 1 # TEST FILE FOR REVERSE # DO NOT MODIFY 3 4 from Queue import Queue 5 from reverse import reverse 6 7 def test_reverse_4(): 8 assert reverse(Queue (list(range(1, 5)))) == Queue ( [4, 3, 2, 1]) 9 10 def test_reverse_0(): 11 assert reverse(Queue ([])) == Queue ([]) 12 13 def test_reverse_1(): 14 || assert reverse(Queue ([@])) == Queue ([0]) 15 16 def test_reverse_str(): 17 assert reverse(Queue ([1 for 1 in "hello"])) == Queue ([1 for 1 in "olleh"]) 18 19 def test_reverse_many(): 20 assert reverse(Queue (list(range(0, 101,5)))) == Queue (list(range(100,-1,-5))) 21 22 def test_reverse_neg(): 23 assert reverse(Queue (list(range(1,-10, -1)))) == Queue (list (range(-9, 2))) 24 2 4 L

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

14-18 Compare the two major types of planning and control tools.

Answered: 1 week ago