Skip to content

Language

Sign in

← All labs

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.

Six steps: predict, try, observe, record, explain and check. The Record step adds a row to your observation table, and the Check step scores your quick quiz.

Loading the lab…

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.
Chapters that use this lab (1)

Printable activity sheet (paper version)

Ask Flint AI
Stack: last in, first out · EduFlint