Is coding a working calculator possible? (without "import math")
Dear fellow learners, I programmed a calculator that can easily calculate with 3 inputs: two numbers and an arithmetic operator. Then I tried to add third number to the calculation, which will be calculated with the result of the first two numbers (ignoring the mathematical laws for now) The calculation won't work if i only use 3 inputs and also turn out an eof error with the var a if I use all 5 inputs. Please give me your opinion on how I can improve the calculator. Thanks a lot. This is my code: while True: x=float(input()) z=str(input()) y=float(input()) a=str(input()) b=float(input()) if z == "+": result=x+y elif z == "-": result=x-y elif z == "*": result=x*y elif z == "/": result=x/y elif z =="**": result=x**y else : result=x//y if a == "" or b == "" : print(x,z,y,"=",result) else : if a == "+": result+=b elif a == "-": result-=b elif a == "*": result*=b elif a == "/": result/=b elif a =="**": result**=b else : result//=b print(x,z,y,a,b,"=",result)