SUPPLEMENTS
To get the most out of the presentation, you should execute each code example in parallel with reading the corresponding discussion in the book. On the book’s web page at
http://www.deitel.com
we provide:
- Downloadable Python source code (.py files) and Jupyter Notebooks (.ipynb files) for the article’s code examples.
- Getting Started videos showing how to use the code examples with IPython and Jupyter Notebooks. We also introduce these tools in Section 1.5.
- Blog posts and book updates.
Before You Begin
This section contains information you should review before using this article. We’ll post
updates at: http://programming-king-juttbadshah.blogspot.com.
FONT AND NAMING CONVENTIONS
We show Python code and commands and file and folder names in a sansserif
font, and onscreen components, such as menu names, in a bold sansserif font.
We use italics for emphasis and bold occasionally for strong emphasis.
GETTING THE CODE EXAMPLES
You can download the examples.zip file containing the article’s examples from our
Python for Programmers web page at:
http://programming-king-juttbadshah.com
Click the Download Examples link to save the file to your local computer. Most web
browsers place the file in your user account’s Downloads folder. When the download completes, locate it on your system, and extract its examples folder into your user account’s Documents folder:
- Windows: C:\Users\YourAccount\Documents\examples
- macOS or Linux: ~/Documents/examples
Most operating systems have a builtin extraction tool. You also may use an archive tool such as 7Zip (www.7zip.org) or WinZip (www.winzip.com).
STRUCTURE OF THE EXAMPLES FOLDER
You’ll execute three kinds of examples in this book:
- Individual code snippets in the IPython interactive environment.
- Complete applications, which are known as scripts.
- Jupyter Notebooks—a convenient interactive, webbrowserbased environment in which you can write and execute code and intermix the code with text, images and video.
We demonstrate each in Section 1.5’s test drives.
The examples folder contains one subfolder per chapter. These are named ch##, where ## is the twodigit chapter number 01 to 16—for example, ch01. Except for Chapters 13, 15 and 16, each chapter’s folder contains the following items:
- snippets_ipynb—A folder containing the chapter’s Jupyter Notebook files.
- snippets_py—A folder containing Python source code files in which each code snippet we present is separated from the next by a blank line. You can copy and paste these snippets into IPython or into new Jupyter Notebooks that you create.
- Script files and their supporting files.
Chapter 13 contains one application. Chapters 15 and 16 explain where to find the files you need in the ch15 and ch16 folders, respectively.
INSTALLING ANACONDA
We use the easytoinstall Anaconda Python distribution with this article. It comes with
almost everything you’ll need to work with our examples, including:
- the IPython interpreter,
- most of the Python and data science libraries we use,
- a local Jupyter Notebooks server so you can load and execute our notebooks, and
- various other software packages, such as the Spyder Integrated Development Environment (IDE)—we use only IPython and Jupyter Notebooks in this article.
Download the Python 3.x Anaconda installer for Windows, macOS or Linux from:
When the download completes, run the installer and follow the onscreen instructions. To ensure that Anaconda runs correctly, do not move its files after you install it.
UPDATING ANACONDA
Next, ensure that Anaconda is up to date. Open a commandline window on your
system as follows:
- On macOS, open a Terminal from the Applications folder’s Utilities subfolder.
- On Windows, open the Anaconda Prompt from the start menu. When doing this to update Anaconda (as you’ll do here) or to install new packages (discussed momentarily), execute the Anaconda Prompt as an administrator by right-clicking, then selecting More > Run as administrator. (If you cannot find the Anaconda Prompt in the start menu, simply search for it in the Type here to search field at the bottom of your screen.)
- On Linux, open your system’s Terminal or shell (this varies by Linux distribution).
In your system’s commandline window, execute the following commands to update
Anaconda’s installed packages to their latest versions:
1. conda update conda
2. conda update --all
PACKAGE MANAGERS
The conda command used above invokes the conda package manager—one of the two key Python package managers you’ll use in this book. The other is pip. Packages contain the files required to install a given Python library or tool. Throughout the book, you’ll use conda to install additional packages, unless those packages are not available through conda, in which case you’ll use pip. Some people prefer to use pip exclusively as it currently supports more packages. If you ever have trouble installing a package with conda, try pip instead.