Skip to content

Update Basic calculator#1

Open
Donaldodan wants to merge 2 commits intomainfrom
Donaldodan-patch-1
Open

Update Basic calculator#1
Donaldodan wants to merge 2 commits intomainfrom
Donaldodan-patch-1

Conversation

@Donaldodan
Copy link
Copy Markdown
Collaborator

No description provided.

@Donaldodan Donaldodan requested a review from yusufom August 16, 2023 11:51
Copy link
Copy Markdown
Member

@yusufom yusufom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done on your approach.

@@ -19,6 +18,10 @@ def divide(x,y):
def modulus(x,y):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no check for zero division error in both divide and modulus function so the code will fail when user tries to divide 1 by 0.

better approach would be.

def divide(x,y):
try:
return x / y
except ZeroDivisionError as e:
return e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants