IPython preserves both the commands and their results of the current session. We can scroll through the previous commands by pressing the up and down keys.
Besides, last three objects of output are stored in special variables _, __ and ___. The history magic command shows previous commands in current session as shown in the screenshot given below −