Description KiKi implements a simple calculator that can add, subtract, multiply and divide two numbers. The user enters the operation "operand 1 operator operand 2" from the keyboard to calculate and output the value of the expression. If the input operation symbol is not included in the range (+, -, *, /), the output "Invalid operation!" . When the operator is a division operation, namely "/". If the operand 2 is equal to 0.0, the output "Wrong! Division by zero!" Input description: multiple groups of inputs, one line, operand 1 operand 2 (including four symbols: +, -, *, /). Output description: For each group of inputs, the output is one line. If both operand and symbol are valid, an expression is printed with operand 1 and operand 2= the result of the operation, with four digits reserved after the decimal point and no Spaces between the number and symbol. If the input operation symbol is not in the range of (+, -, *, /), the output "Invalid operation! . When the operator is a division operation, namely "/". If the operand 2 is equal to 0.0, the output "Wrong! Division by zero!" .Copy the code

while True: try: getin=input() f=True for c in getin: if c not in ['0','1','2','3','4','5','6','7','8','9','.','+','-','*','/']: print("Invalid operation!" ) f=False break if f: if getin.find("+")! = 1: pos=getin.find("+") op1=float(getin[0:pos]) op2=float(getin[pos+1:]) print("%.4f+%.4f=%.4f"%(op1,op2,op1+op2)) elif getin.find("-")! = 1: pos=getin.find("-") op1=float(getin[0:pos]) op2=float(getin[pos+1:]) print("%.4f-%.4f=%.4f"%(op1,op2,op1-op2)) elif getin.find("*")! = 1: pos=getin.find("*") op1=float(getin[0:pos]) op2=float(getin[pos+1:]) print("%.4f*%.4f=%.4f"%(op1,op2,op1*op2)) else: pos=getin.find("/") op1=float(getin[0:pos]) op2=float(getin[pos+1:]) if op2==0: print("Wrong! Division by zero!" ) else: print("%.4f/%.4f=%.4f"%(op1,op2,op1/op2)) except: breakCopy the code