Instead of a calculator, I tend to use IPython for those quotidian bits of "mental" arithmetic:

In[1]:17*22.2Out[1]:377.4

However, I often forget to actually start IPython, resulting in me running the following in my shell:

$ 17 * 22.2
zsh: command not found: 17

Whilst I could learn do this maths within Zsh itself, I would prefer to dump myself into IPython instead — being able to use "_" and Python modules generally is just too useful.

After following this pattern too many times, I put together the following snippet that will detect whether I have prematurely attempted a calculation inside zsh and pretend that I ran it in IPython all along: