On bash or Window\'s Command Prompt, we can press the up arrow on keyboard to get the last command, and edit it, and press ENTER again to see the result.
But in Python\'
just use Alt+P to go up. Similarly, Alt+N could be used to go down.
Alt+P
Alt+N