← back to unit
Easy
# stacks easy
Browser Back Button
Where does the back button actually take you? Wherever the history pile says. 🌐
You start on home. You get commands — visit:site goes to a new page, back returns to the previous one (never past home). Print the page you end on.
Example:
Input: commands = ["visit:zoo", "visit:games", "back"]
Output: zoo
The history pile grows to [home, zoo, games]. back pops games off the top, leaving zoo as where you end up.
💡 need a hint?
stk-browser-back.py🔒 given lines are locked — write your code in between
loading...