A taste of Python¶
This tutorial is based on a the Software Carpentry group’s lessons on Programming with Python.
We will start our Python lesson by opening a program called Spyder. We’ll learn more about how Spyder works later in the course, but for now we will be using some basic features of Spyder such as the IPython console. In the IPython console you can type in Python commands and press Enter to execute them.
We can start by launching Spyder.
- In Windows, this can be done by clicking on Programs -> Anaconda -> Spyder in the start menu.
- On a Mac or in Linux, Spyder can be launched from a terminal by typing
The Spyder window should appear after a moment and it will look something like the one below. For now, we are only interested in using the IPython console in the lower right panel (outlined in red).
Now we are ready to start. In the lesson that follows, simply enter the commands into the IPython console and press Enter to execute them.
Variables, arithmetic and modules¶
We will start our Python lesson by learning a bit of the basic operations you can perform using Python.
Python can be used as a simple calculator.
In : 1 + 1 Out: 2 In : 5 * 7