-
-
Notifications
You must be signed in to change notification settings - Fork 46.6k
Updated Stack #2414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated Stack #2414
Conversation
* Added test * Formated code
@cclauss Please review. Thanks :) |
data_structures/stacks/stack.py
Outdated
if self.is_empty(): | ||
raise IndexError("pop from an empty stack") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it do exactly the same thing if you remove lines 29 and 30?
data_structures/stacks/stack.py
Outdated
if self.is_empty(): | ||
raise IndexError("peek from an empty stack") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it do a similar thing if you remove lines 35 and 36?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line3 35 and 36 execute when stack is empty. assert()
statements will still be successful if i remove them .
Need I update @cclauss ? |
Thanks @cclauss . Nice updates. LGTM 👍 |
* * Added type hints * Added test * Formated code * updating DIRECTORY.md * Update stack.py * Test error conditions for pop, peek, and Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: Christian Clauss <cclauss@me.com>
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}
.