The Second Calculator
This is the second version of my calculator
This is a second version of the calculator that I posted before. I know people were having problems, so I came up with an easier to use calculator. Here is the code you will need:
running = True while running: num1 = input() operator = input() num2 = input() if operator == "+" or operator == "plus": answer = float(num1) + float(num2) if operator == "-" or operator == "minus": answer = float(num1) - flaot(num2) if operator == "*" or operator == "x" or operator == "X" or operator == "times": answer = float(num1) * float(num2) if operator == "\" or operator == "/" or operator == "diveded by": answer = float(num1) / float(num2) if operator == "quit": running = False print(operator)
this, I tested in a repl. If there are any errors, please say them in the comments. It's possible I may have imported a typo. This should work, and I also aloud the possible quit, if you wanted to leave.
Voters
Spelling alert!
Escape alert!
Division should be:
@CodeLongAndPros yep, but there aren't two 's there
@gatorade322 You need to escape the backslash. Add syntax highlighting to your code block. (```python)
@CodeLongAndPros OH OK, how to do that?