Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Update evaluate_postfix_notations.py #8758
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
Update evaluate_postfix_notations.py #8758
Changes from 11 commits
005f9c5
4eb8123
7646a57
de04120
9a92b82
ecd9e74
3559a55
7f6a692
748eff5
816120b
9e6f36a
2779cd0
2bbac37
c4f050e
c3a7c67
29b28ec
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Currently, if there's only 1 operand on the stack but the token is not
-
, then it just appends the operand back onto the stack. This effectively leaves the stack exactly as it already was, so you can skip that altogether.Furthermore, checking
len(stack) < 2
includes the case in which the stack is empty. This should raise an error since there's no operand to negate.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.
I'm not able to commit above change requested...!!