Python for Software Design

How to Think Like a Computer Scientist

by Allen B. Downey

Buy this book at

Order a review copy of this book from Cambridge University Press.

A newer edition of this book is available with the title Think Python.


Python for Software Design is a concise introduction to software design using the Python programming language. Intended for people with no programming experience, this book starts with the most basic concepts and gradually adds new material. Some of the ideas students find most challenging, like recursion and object-oriented programming, are divided into a sequence of smaller steps and introduced over the course of several chapters.

The focus is on the programming process, with special emphasis on debugging. The book includes a wide range of exercises, from short examples to substantial projects, so that students have ample opportunity to practice each new concept. Exercise solutions and code examples are available from this web site (links are in the book), along with Swampy, a suite of Python programs that is used in some of the exercises.

  • Concise and easy-to-read style written for both high school and college students;

  • Special emphasis on debugging and the programming process, with examples of program development plans;

  • Range of exercises, from short examples to substantial projects, with solutions and example code available on the web.


1. Preface; 2. The way of the program; 3. Variables, expressions and statements; 4. Functions; 5. Case study: interface design; 6. Conditionals and recursion; 7. Fruitful functions; 8. Iteration; 9. Strings; 10. Case study: word play; 11. Lists; 12. Dictionaries; 13. Tuples; 14. Case study: data structure selection; 15. Files; 16. Classes and objects; 17. Classes and functions; 18. Classes and methods; 19. Inheritance; 20. Case study: tkinter; Appendix 1: debugging.

(ISBN-13: 9780521898119)

Earlier Versions

This book is a substantially revised version of How to Think Like a Computer Scientist: Learning with Python.

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

Are you using one of our books in a class?

We'd like to know about it. Please consider filling out this short survey.

Think DSP

Think Java

Think Bayes

Think Python 2e

Think Stats 2e

Think Complexity