Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while True:
- operator=input("Would you like to add, subtract, divide or multiply or exit? Please choose one. ")
- if operator=="add":
- num1=int(input("What is the first number you would like to add? "))
- num2=int(input("What is the second number you would like to add? "))
- total=num1+num2
- elif operator=="subtract":
- num1=int(input("What number would you like to subtract from? "))
- num2=int(input("Which number would you like to subtract? "))
- total=num1-num2
- elif operator=="divide":
- num1=int(input("What number would you like to divide? "))
- num2=int(input("Please input the number you would like to divide by "))
- total=num1/num2
- elif operator=="multiply":
- num1=int(input("Please input the first number you would like to multiply "))
- num2=int(input("Please input the second number you would like to multiply "))
- total=num1*num2
- elif operator=="exit":
- break
- else:
- print ("The option you have chosen is not valid.")
- continue
- print ("The total is ",total)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement