i made a four-function calculator in one line:
while True: a=float(input("\nfirst number: "));b=float(input("second number: "));op=int(input("what operation? 1,2,3,4 for add,sub,mul,div: "));print("\nanswer: "+str(a+b if op==1 else (a-b if op==2 else (a*b if op==3 else a/b))))
oh, wait. This is smaller:
while 1:print(eval(input()))
but that uses eval(). here's a smaller one that doesn't:
while 1:n=input;f=float;a=f(n());p=["","+","-","*","/"];o=p.index(n());b=f(n());print(str(a+b if o==1 else(a-b if o==2 else(a*b if o==3 else a/b))))
And smaller yet:
while 1:n=input;f=float;a=f(n());o=["","+","-","*","/"].index(n());b=f(n());print(str(a+b if o==1 else(a-b if o==2 else(a*b if o==3 else a/b))))