← back to unit
Easy
# stacks easy
The Pancake Pile
Pancakes come off the pan one at a time and go ON TOP of the pile — then you eat from the top. 🥞
You get the pancakes in cooking order. Push them all onto a pile (a plain list with .append()), then pop them off one by one with .pop(), printing the eating order on one line, space-separated.
Example:
Input: pancakes = ["blueberry", "banana", "plain", "choco"]
Output: choco plain banana blueberry
Pushing all four stacks choco on top. Popping takes the top first, so choco — the last one cooked — is the first one eaten.
💡 need a hint?
stk-pancake-pile.py🔒 given lines are locked — write your code in between
loading...