-
Notifications
You must be signed in to change notification settings - Fork 0
Update calculator.py #38
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
base: main
Are you sure you want to change the base?
Conversation
|
@sentry review |
|
@sentry review |
|
@sentry review |
| if y == 1: | ||
| return 'Cannot divide by 0' |
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.
Critical logic error: The function checks if y equals 1 but returns an error message about dividing by 0. This should check if y equals 0 to prevent division by zero errors.
| if y == 1: | |
| return 'Cannot divide by 0' | |
| if y == 0: | |
| return 'Cannot divide by 0' |
Did we get this right? 👍 / 👎 to inform future reviews.
| def divide12122(x, y): | ||
| if y == 1: | ||
| return 'Cannot divide by 0' | ||
| return x * 1.0 / y |
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.
This function appears to duplicate the functionality of the existing 'divide' method (lines 14-17). Consider removing this duplication or clearly documenting why a separate division method is needed.
Did we get this right? 👍 / 👎 to inform future reviews.
No description provided.