IPython is an interactive shell that is equivalent to an interactive computing environment such as Matlab or Mathematica. This interactive shell was created for the purpose of quick experimentation. It is a very useful tool for data professionals that are performing small experiments.
IPython shell offers the following features:
- Easy access to system commands.
- Easy editing of inline commands.
- Tab completion, which helps you find commands and speed up your task.
- Command History, which helps you view previously used commands.
- Easily execute external Python scripts.
- Easy debugging with the Python debugger.
Now, let's execute some commands on IPython. To start IPython, use the following command on the command line:
$ ipython3
When you run the preceding command, the following window will appear:
Now, let's understand and execute some commands that the IPython shell provides:
- History Commands: The history command used to check the list of previously used commands. The following screenshot shows how to use the history command in IPython:
- System Commands: We can also run system commands from IPython using the exclamation sign (!). Here, the input command after the exclamation sign is considered a system command. For example, !date will display the current date of the system, while !pwd will show the current working directory:
- Writing Function: We can write functions as we would write them in any IDE, such as Jupyter Notebook, Python IDLE, PyCharm, or Spyder. Let's look at an example of a function:
- Quit Ipython Shell: You can exit or quit the IPython shell using quit() or exit() or CTRL + D:
You can also quit the IPython shell using the quit() command:
In this subsection, we have looked at a few basic commands we can use on the IPython shell. Now, let's discuss how we can use the help command in the IPython shell.