print("Try not to add any words together.\nLet's do some math") while(1): response = input("Type in what kind of math you would like to do; Addition, Subtraction, Multiplication, Division: ") if response == "No": print("Exiting") elif response == "Addition": print("Alright then put in the two numbers you're wanting in your equation") number1 = input("Put First number here: ") number2 = input("Put Second number here: ") if not number1.isdigit() and not number2.isdigit(): print("What are you attempting to add, LETTERS?") else: print(number1 + " + " + number2 + " = " + str((int(number1) + int(number2)))) elif response == "Multiplication": print("Alright then put in the two numbers you're wanting in your equation") number1 = input("Put First number here: ") number2 = input("Put Second number here: ") if not number1.isdigit() and not number2.isdigit(): print("What are you attempting to multiply, LETTERS?") else: print(number1 + " * " + number2 + " = " + str((int(number1) * int(number2)))) elif response == "Subtraction": print("Alright then put in the two numbers you're wanting in your equation") number1 = input("Put First number here: ") number2 = input("Put Second number here: ") if not number1.isdigit() and not number2.isdigit(): print("What are you attempting to subtract, LETTERS?") else: print(number1 + " - " + number2 + " = " + str((int(number1) - int(number2)))) elif response == "Division": print("Alright then put in the two numbers you're wanting in your equation") number1 = input("Put First number here: ") number2 = input("Put Second number here: ") if not number1.isdigit() and not number2.isdigit(): print("What are you attempting to divide, LETTERS?") else: print(number1 + " / " + number2 + " = " + str((int(number1) / int(number2)))) else: print("Exiting.")
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question