4 ms·
How to Write a Calculator in 1 Python Line print input() > 25*4-50 > 50
by philfreo 14y ago
How to Write a Calculator in 1 Python Line
print input()
> 25*4-50
> 50
- edwintorok 14y agoIt accepts more than just numbers though: >>> print input() "a"+"b" ab
- BerislavLopac 14y agoThe. Best. Comment. Ever. :-)
- prezjordan 14y ago...100? Your calculator seems broken :)
- philfreo 14y agohaha thanks, fixed
- waltz 14y agoor just 'python'
- erezsh 14y agoQ. How to write code? A. I don't need to; other people will write it for me. That's fine, I guess. I prefer to understand.
- pekk 14y agoHow to get things done? Use existing tools unless they are not suitable.
- gshubert17 14y agoOr, from a bash command line, $ python -c "print input('> ')" > 2+3*5 17