How to Write a Calculator in 1 Python Line
print input()
> 25*4-50
> 50 print input()
> 25*4-50
> 50A. I don't need to; other people will write it for me.
That's fine, I guess. I prefer to understand.
>>> print input()
"a"+"b"
ab try:print(lambda x:eval(x)if all(i in'0123456789.*/+-'for i in x)else'syntax error')(raw_input())
except:print'error'$ python -c "print input('> ')" > 2+3*5 17