Skip to content

Commit

Permalink
Adding subtraction
Browse files Browse the repository at this point in the history
  • Loading branch information
bmm21002 committed Feb 12, 2025
1 parent 25a2776 commit d62cab3
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
@@ -1,11 +1,13 @@
def add(x,y):
return x+y

def sub(x,y):
return x-y

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

Expand All @@ -15,6 +17,9 @@ def calc():
if operation == "+":
print(add(x,y))

if operation == "-":
print(sub(x,y))


if __name__ == "__main__":
calc()

0 comments on commit d62cab3

Please sign in to comment.