Think Python

 

Write a function named rightjustify that takes a string named s as a parameterand prints the string with enough leading spaces so that the las. The Way of the Program - Think Python, 2nd Edition Book Chapter 1. The Way of the Program The goal of this book is to teach you to think like a computer scientist.

Think Python First Edition, by Allen B. Downey

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.

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). The code is also available from this GitHub repository.

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

Think python 2e
  • Precompiled copies of the book are available in PDF.
  • The LaTeX source code is available from this GitHub repository.
2nd

Think Python 2nd Edition Solutions

Earlier Versions

Think Python Runestone

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.

Think

The original Python version of the book was published by Green Tea Presswith 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 availablehere.

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

Think Python

Python Textbook Pdf

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.

Think Python 2nd Edition

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