Learn

Nice work — you’ve built out a Stack class that can:

  • add a new item to the top via a push() method
  • remove an item from the top and returns its value with a pop() method
  • return the value of the top item using a peek() method
  • allows a stack instance to maintain an awareness of its size to prevent stack “overflow”

So how does your code stack up against pizza delivery?

Instructions

1.

Uncomment the push() and pop() statements at the bottom of your code to see your Stack class help a pizza delivery place efficiently manage delivering a stack of pizzas.

Sign up to start coding

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Already have an account?