Learn

Congrats! You have just implemented a queue data structure in Python by creating a Queue class that:

  • follows FIFO protocol with enqueue(), dequeue(), and peek() methods
  • gives you the option of creating bounded queues with a max_size
  • prevents queue “overflow” and “underflow” by keeping track of size

Instructions

1.

At the bottom of queue.py, uncomment the commented statements and run your code to see some queue-tiful code in action!

Sign up to start coding

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

Already have an account?