Conversation
kyra-patton
left a comment
There was a problem hiding this comment.
✨🌸 Hi Lilly, take another look at your str implementation for Stack; I think there were some missteps there. Otherwise, your implementations for Queue and Stacks looked really solid.
Since the comprehension questions were not filled out, I'm grading this as a yellow. Feel free to resubmit with them filled out and your 'str' method updated for a green score.
🟡
| In the store are occupied | ||
| returns None | ||
| """ | ||
| pass |
There was a problem hiding this comment.
resubmitted, some formatting was off for questions, and missing a couple answers
| Raises a QueueEmptyException if | ||
| The Queue is empty. | ||
| """ | ||
| pass |
| if self.front == -1: | ||
| return None |
There was a problem hiding this comment.
Because you never check in dequeue whether dequeuing an element makes the Queue empty and, if the Queue does become empty, reset front to point at index -1, it may not always be true that the front pointer is at index -1 when the queue is empty. Try using the empty method you implement instead.
| if self.front == -1: | |
| return None | |
| if self.empty(): | |
| return None |
| The Queue | ||
| """ | ||
| pass | ||
| return self.size |
| And False otherwise. | ||
| """ | ||
| pass | ||
| return self.size == 0 |
| """ Returns the Queue in String form like: | ||
| [3, 4, 7] | ||
| Starting with the front of the Queue and | ||
| ending with the rear of the Queue. |
| Returns None | ||
| """ | ||
| pass | ||
| self.store.add_first(element) |
| returns None | ||
| """ | ||
| pass | ||
| return self.store.remove_first() |
| And False otherwise | ||
| """ | ||
| pass | ||
| return self.store.empty() |
stacks_queues/stack.py
Outdated
| String = "[" + str(self.store.first()) + "]" | ||
| return String |
There was a problem hiding this comment.
String is a keyword (name of the String class) in Python, so you want to avoid using it as your variable name. Additionally, you're only returning the first element of the Stack here - the specification asks for the entire stack to be printed instead. The Stack tests don't cover this method which is why they didn't catch this.
Try taking advantage of the str method in the LinkedList class instead.
|
resubmitted |
Stacks and Queues
Thanks for doing some brain yoga. You are now submitting this assignment!
Comprehension Questions
| What is the difference between implementing something and using something? | Implementing something is create a method yourself versus using something that was already created |
OPTIONAL JobSimulation