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



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

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

Or sign up using:

Already have an account?