Conversation
kyra-patton
left a comment
There was a problem hiding this comment.
✨🌸 Nice work, Ana. Please check your implementation of front for the Queue class. I also left some minor style suggestions, but overall good work. Let me know what questions you have.
🟢
| """ | ||
| pass | ||
| if self.size == self.buffer_size: | ||
| raise QueueFullException('This will break it') |
There was a problem hiding this comment.
Small suggestion: When raising an exception, it's helpful to give a description of why the code is breaking
| raise QueueFullException('This will break it') | |
| raise QueueFullException('Queue full') |
| Raises a QueueFullException if all elements | ||
| In the store are occupied | ||
| returns None | ||
| """ |
| # find element in the store | ||
| # First in first out | ||
| if self.size == 0: | ||
| raise QueueEmptyException('This will break it') |
There was a problem hiding this comment.
Same thing as above with the Exception here ⬆️
| """ Removes and returns an element from the Queue | ||
| Raises a QueueEmptyException if | ||
| The Queue is empty. | ||
| """ |
| pass | ||
|
|
||
| if self.store[self.front]: | ||
| return self.store[0] |
There was a problem hiding this comment.
The current tests don't cover front which is why you may not have caught this.
| return self.store[0] | |
| return self.store[self.front] |
| [3, 4, 7] | ||
| Starting with the front of the Queue and | ||
| ending with the rear of the Queue. | ||
| """ |
| pass | ||
|
|
||
| self.store.add_last(element) | ||
| return element |
There was a problem hiding this comment.
Per the specification, this function should return None
| return element |
| if not self.store: | ||
| raise StackEmptyException("List is empty") | ||
|
|
||
| return self.store.remove_last() |
There was a problem hiding this comment.
Again, per the function specification, this method should return None
| return self.store.remove_last() | |
| self.store.remove_last() |
| And False otherwise | ||
| """ | ||
| pass | ||
| return self.store.empty() |
| ending with the bottom of the Stack. | ||
| """ | ||
| pass | ||
| values = [] |
There was a problem hiding this comment.
✨ Yes, this works! You could also take advantage of the str method in the LinkedList class
Stacks and Queues
Thanks for doing some brain yoga. You are now submitting this assignment!
Comprehension Questions
OPTIONAL JobSimulation