This book is meant to be used as a course. It is not meant as a Python language reference. You do not need a book as a language reference, as an excellent language reference can be found on the Internet (http://docs.python.org1).

The chapters of this book are written to be studied in sequential order. For a brief course on the basics of the Python language, using it for “imperative programming,” you should study variables and expressions, conditions and loops, functions, string handling, lists and dictionaries, and files. I.e., you can limit yourself to Chapters 2 to 20, whereby the Chapters 10 (Recursion), 15 (Sets), 18 (Exceptions), 19 (Binary files), and 20 (Bitwise operators) may be considered advanced material, which you can skip until you need them (though I highly recommend that you at least try to understand recursion, as it helps solving some of the exercises in later chapters).

For an advanced course on the basics of the Python language, you will have to delve into object orientation, meaning that you also have to study Chapters 21 to 24, whereby Chapter 24 (Iterators and Generators) can be considered optional material.

The remainder of the chapters are all useful, but optional material, from which you can pick and choose, though I recommend that you at least read through them to understand the topics that they cover. Future editions of this book may have extra optional material added to the end.

When studying this book, you should have a computer with Python installed at hand (Chapter 3 explains how to get Python for your computer). The book contains many small and larger exercises, and you should do all of those while studying. There is no way that you will learn how to program if you skip the exercises. More on the exercises follows later in this chapter (Section [sec:introduction.practice]2).

Many of the code snippets in this book – in particular all the answers to the exercises and all the slightly longer pieces of code – have a file name listed as a caption. This means that this code is available under that particular file name from the website associated with this book (http://www.spronck.net/pythonbook3). You can download this code and load it immediately in the editor that you are using if you so wish.

Note

Note that copying and pasting code from a PDF file to an editor will, in general, not work. Text in a PDF file is not stored in such a way that spaces are inserted in the correct places when you copy code. So you must either manually type in code, or use the listings that are provided as separate files.