Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- num1 = input("Enter a number: ")
- num2 = input("Enter another number: ")
- calculator = input("Enter 'add', 'subtract', 'multiply', or 'divide': ")
- if calculator == "add":
- result = int(num1) + int(num2)
- print(result)
- elif calculator == "subtract":
- result = int(num1) - int(num2)
- print(result)
- elif calculator == "multiply":
- result = int(num1) * int(num2)
- print(result)
- elif calculator == "divide":
- result = int(num1) / int(num2)
- print(result)
- else:
- print("That is not a valid method of math!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement