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 () 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 () below!
Agree with a comment or answer? Like () to up-vote the contribution!
I just can’t understand why set the next node of the current tail to the item_to_add. When i think of a queue i think in setting the next node of item_to_add to the current tail, not the otherwise.
You’re basically saying. If the Queue is NOT empty. Add John(item_to_add) to the back of the queue and tell Mary(tail), that was previously at the back, that John is now behind her. After that you tell your program, that Adam is now the “tail” of the queue.
Remember that “self.tail.set_next_node(item_to_add)” is telling the current tail, that item_to_add is coming after it.
as far as I can see set_next_node() is a method of Node class. In the exercise we use this method on a Queue class object q. To put it exactly: We do self.tail.set_next_node(item_to_add) where self is a Queue object. isinstance(self, Node) yields False, i.e self is not an instance of Node. So my question is: Why can we use a method of a different class (Node) on a class (Queue) which is not inherited from the first class ? Why doesn’t self.tail.set_next_node(item_to_add) throw an error ?
During step 2 I am getting “Did you add self and value as paramenters for enqueque()?” (the misspelling is there). The weird thing is that I defined enqueque() with parameters self and value in step 1 and I passed that step.
When I replace my code (below) with the solution code, it lets me pass.