According to the Association for Computing Machinery, Python is the top teaching language in the United States, with it being more commonly taught in introductory programming classes than BASIC, Java, and even C. This section will cover the basics of installing, using, and running Python 3.x and Python programs.
If you have OS X or almost any flavor of Linux, you likely already have Python installed. If in doubt, type the following into your command line:
We will be using Python 3.x throughout this book. If you see that you have Python 2.x installed, you upgrade on Linux simply by calling
Note this might involve needing to execute your Python code by typing
$python3 myScript.py into the command line, rather than
The OS X operating system, as of this writing, has Python 2.7 installed by default. To install Python 3.x, download an installer from the Python website. Again, if you are running both Python 2.x and Python 3.x simultaneously, you might need to explicitly call Python 3.x using
For Windows users without Python installed, there are precompiled installers available for download. Simply download, open, and install. You might also need to set the Windows system path to the directory in which you install Python in order to tell the operating system where it’s at, but the website and installers have fairly straightforward ...