Skip to content

Adding multiplication #3

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
10 changes: 8 additions & 2 deletions hw01/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ def add(x,y):
def sub(x,y):
return x-y

def mult(x,y):
return x*y

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

Expand All @@ -20,6 +23,9 @@ def calc():
if operation == "-":
print(sub(x,y))

if operation == "*":
print(mult(x,y))


if __name__ == "__main__":
calc()