Think Python

Think Python#

Think Python is an introduction to Python for people who have never programmed before – or for people who have tried and had a hard time. You can order print and ebook versions of the third edition from Bookshop.org and Amazon.

https://raw.githubusercontent.com/AllenDowney/ThinkPython/v3/think_python_3e.jpg

Here is the landing page for the book at Green Tea Press.

For the third edition, the biggest changes are:

  • The book is now entirely in Jupyter notebooks, so you can read the text, run the code, and work on the exercises – all in one place. Using the links below, you can run the notebooks on Colab, so you don’t have to install anything to get started.

  • The text is substantially revised and a few chapters have been reordered. There are more exercises now, and I think a lot of them are better.

  • At the end of every chapter, there are suggestions for using tools like ChatGPT and Colab AI to learn more and to get help with the exercises.

The notebooks#

Chapter 1: Programming as a way of thinking

Chapter 2: Variables and Statements

Chapter 3: Functions

Chapter 4: Functions and Interfaces

Chapter 5: Conditionals and Recursion

Chapter 6: Return Values

Chapter 7: Iteration and Search

Chapter 8: Strings and Regular Expressions

Chapter 9: Lists

Chapter 10: Dictionaries

Chapter 11: Tuples

Chapter 12: Text Analysis and Generation

Chapter 13: Files and Databases

Chapter 14: Classes and Functions

Chapter 15: Classes and Methods

Chapter 16: Classes and Objects

Chapter 17: Inheritance

Chapter 18: Python Extras

Chapter 19: Final Thoughts

Resources for teachers#

If you are teaching with this book, here are some resources you might find useful.

  • You can download notebooks with solutions from this GitHub repository.

  • Quizzes for each chapter, and a summative quiz for the whole book, are available on request.

  • Teaching and Learning with Jupyter is an online book with suggestions for using Jupyter effectively in the classroom. You can read the book here.

  • One of the best ways to use notebooks in the classroom is live coding, where an instructor writes code and students follow along in their own notebooks. To learn about live coding – and a lot of other great advice about teaching programming – I recommend the teacher training provided by The Carpentries, which you can read here.

  • For each chapter, I’ve created a “blank” notebook with the original text, but most of the code removed. These notebooks are useful for doing follow-along exercises where learners fill in the blanks. Links to the blank notebooks are here.