Think Python

How to Think Like a Computer Scientist

This is the first edition of Think Python, which uses Python 2.

If you are using Python 3, you might want to use the second edition, which is here.

Buy this book at Amazon.com

Download Think Python in PDF.

Read Think Python in HTML.

Example programs and solutions to some problems are here (links to specific examples are in the book).

Description

Think Python is an introduction to Python programming for beginners. It starts with basic concepts of programming, and is carefully designed to define all terms when they are first used and to develop each new concept in a logical progression. Larger pieces, like recursion and object-oriented programming are divided into a sequence of smaller steps and introduced over the course of several chapters.

Some examples and exercises are based on Swampy, a Python package written by the author to demonstrate aspects of software design, and to give readers a chance to experiment with simple graphics and animation.

Think Python is a Free Book. It is available under the Creative Commons Attribution-NonCommercial 3.0 Unported License, which means that you are free to copy, distribute, and modify it, as long as you attribute the work and don't use it for commercial purposes.

If you have comments, corrections or suggestions, please send me email at feedback{at}thinkpython{dot}com.

Other Free Books by Allen Downey are available from Green Tea Press.

Download

Precompiled copies of the book are available in PDF.

The LaTeX source code is available from this GitHub repository.

Here is the HTML version, and here is the HTML code in a zip archive.

Earlier Versions

The previous edition of this book was published by Cambridge University press with the title Python for Software Design. This edition is available from Amazon.com.

The original Python version of the book was published by Green Tea Press with the title How to Think Like a Computer Scientist: Learning with Python. This edition is available from from Lulu.com.

Translations and adaptations

Andrea Zanella has translated the book into Italian. The source is in this GitHub repository, or you can download the PDF version.

Sat Kumar Tomer has written a related book, Python in Hydrology available here.

Jeff Elkner, who was my co-author on How to Think, is working on a second edition, available here.

The book Apprendre a programmer avec Python by Gerard Swinnen started as a French translation of How to Think..., but has evolved into a substantially different book.

Ricardo Perez has translated How to Think... into Spanish and adapted it for the Eiffel programming language. His translation is available here.

Other Free Books by Allen Downey are available from Green Tea Press.