Skip to content

Language

Sign in

← Back to the lesson

🔬 Computer science · Class 12 · virtual lab

Stack: last in, first out

Goal: Push, pop and peek on a stack built on a Python list and see why the last item in is the first out.

  1. Predict
  2. Try
  3. Observe
  4. Record
  5. Explain
  6. Check

Loading the lab…

About this lab

Behind the experiment.

What this lab simplifies

  • The stack holds at most six items so overflow can be shown.
  • Items are numbers pushed in order 1, 2, 3 and so on.
  • A real Python list has no fixed size; the limit is only for the lesson.

No screen? Use paper.

The activity sheet has the same steps, a results table and the questions, ready to print.

Printable activity sheet (paper version)All labs

Stack: last in, first out: virtual lab · EduFlint