Skip to content

Adding division #4

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()