Project Python is a free interactive book that will teach you to code in Python, using graphics, animations, and games. You’ll also learn ways to solve classical computer science problems, principles of software design, and how to analyze algorithm performance. No prior experience required; you’ll write code to draw a smiley face by the end of the first chapter.

By Devin Balkcom, with significant contributions from Tom Cormen and Hany Farid. We recommend using an updated version of Chrome or Firefox to run the interactive examples.

Contents

  1. Functions, abstraction, and style
  2. Variables and expressions
  3. Loops and conditions
  4. Debugging
  5. Parameters, return values, and scope
  6. Animation; mouse and keyboard input
  7. Lists and for-loops
  8. Reading and writing text files
  9. Nested loops
  10. Physical simulation
  11. Classes and objects
  12. Recursion
  13. Sorting
  14. Analyzing algorithms
  15. Analysis of sorting algorithms
  16. Stacks, queues, and dictionaries
  17. Linked lists
  18. Graphs
  19. Appendix: cs1lib.py reference