Question: Write a function move(L, R) to move all items from the list L to the list R in reverse order. The function should not return

Write a function move(L, R) to move all items from the list L to the list R in reverse order.

The function should not return anything. When the function finishes, the list L should be empty.

Use the docstring """Moves all items from list L to list R in reverse order""".

Do not change the main program. Expected output:

[]
[1, 2, 3, 4, 7, 6, 5]

Hint: Use a while loop combined with pop().

# Main program (do not change): A = [5, 6, 7] B = [1, 2, 3, 4] move(A, B) print(A) print(B)

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!