Overview
Teaching: 5 min
Exercises: 0 minQuestions
How can I run Python programs?
Objectives
Launch iPython.
Run some simple python commands.
Exit the iPython interpreter.
.py
extension to let everyone (including the operating system)
know it is a Python program.
$ ipython
Upon executing the iPython command, the following prompt will appear at the bottom of your screen.
In [1]:
The In
portion indicates that iPython is waiting for input and the [1]
indicates that this is the first command we’ll run in the iPython session.
Let’s start by running a few simple commands to get a feel for interacting with this interpreter.
Type the following command and press return.
In [1]: 2 + 7
After pressing return you should see something like the following.
Out [1]: 9
Here the Out
is indicating that this is the output from the code we executed
in command [1]
.
For the remainder of the workshop, these lessons won’t include the input/output portions shown here but rather just the commands and resulting output.
Installing iPython on your own machine
- The Anaconda package manager is an automated way to install the iPython on your own machine.
- See the setup instructions for Anaconda installation instructions.
- It also installs all the extra libraries it needs to run.
- Once you have installed Python and the iPython requirements, open a shell and type:
Key Points
Use iPython for editing and running Python.
Use the keyboard and mouse to select and edit cells.