FAQ: Queues: Python - Queues Python Size

This community-built FAQ covers the “Queues Python Size” exercise from the lesson “Queues: Python”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Computer Science

Linear Data Structures

FAQs on the exercise Queues Python Size

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

def init(self, max_size=None):
self.head = None
self.tail = None
self.max_size = max_size
self.size = 0

As you can see from the method above, one parameter has been defined inside the method, which is max_size that’s been set to None as default inside the method. And then there’s the other parameter like head and tail that has been said to None as default as well but below the method. What kind of difference does it make exactly?

The Difference is that this makes it easy for a max size to be set at default. The other variables are 100% reliant on each other such as head and tail, you wouldn’t want someone to set those to a certain value that contradicts itself at the start, so they are set later on when working on the queue. Think about them like size which must start at 0.

1 Like

I am a c programmer but I am learning python as well.I am not getting the feel of data structures in python on code academy.For me It was easier to implement data structures in c language .The codeacademy is spoon feeding me.I am frustrated with so many lines of code in python as compared to c.

1 Like

Although i have near zero knowledge in c, i guess you are very capable to recognize data structures. I think what you are learning here is more about the syntax instead of the fundamentals (data structures), i mean, how python works. Comparing both would be frustrating to you, i think you can always check the python documentation to strengthen your understanding.



We should not be afraid of, or neglectful of the documentation right from the horse’s mouth. Always start there then branch out to articles and other tutorials until the basics are cemented in place.

Lists can be linear lists, queues, stacks, or comprehensions. Python gives us the tools to work with each. The thing they have in common is that they are all lists in square brackets.

1 Like

Just wondering, in Queues Python Size the last point says:
“At the top of your peek() method body, use get_size() to see if the queue is empty.”

It instructs me to use “get_size()” but I just finished making an “is_empty()”, why wouldn’t I use that? (and I did use that, TBH)