Skip to content

Commit

Permalink
Adding division
Browse files Browse the repository at this point in the history
  • Loading branch information
bmm21002 committed Feb 12, 2025
1 parent 77a0afa commit bdbade8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions hw01/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ def sub(x,y):
def mult(x,y):
return x*y

def div(x,y):
return x/y

def calc():
while(True):
operation = input("Enter operation from [+,-,*]: ")
if operation =="+" or operation == "-" or operation == "*":
operation = input("Enter operation from [+,-,*,/]: ")
if operation =="+" or operation == "-" or operation == "*" or operation == "/":
break
print("Enter valid operation")

Expand All @@ -26,6 +29,8 @@ def calc():
if operation == "*":
print(mult(x,y))

if operation == "/":
print(div(x,y))

if __name__ == "__main__":
calc()

0 comments on commit bdbade8

Please sign in to comment.