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
Get step-by-step solutions from verified subject matter experts
