# stacks medium

The Careful Mover

Move the whole tower to the other table, one block at a time — then move it back. Watch closely what happens to the order! 🗼

You get the tower blocks bottom to top. Move every block to pile B (popping from A, pushing to B) and print B bottom to top. Then move everything back to A the same way and print A. Two lines, comma-separated.

Example:

Input: blocks = ["red", "green", "blue"] Output:

blue,green,red
red,green,blue

Popping from A (top is blue) and pushing to B reverses the order, giving blue,green,red. Moving it back the same way reverses it again, restoring red,green,blue.

💡 need a hint?

stk-careful-mover.py🔒 given lines are locked — write your code in between
loading...