Learn Python the Right Way

We think that people who want to learn to code using Python should

  • Learn in a no-setup environment so they can focus on code.
  • Learn computer science fundamentals.
  • Practice by building real-world projects.

That's why we created two books.

This website (Learn Python the Right Way) is Part 1. Part 2 is Code with Replit which is a collection of practical tutorials.

You can read each chapter online below, or download the entire book in PDF, ePub or Mobi formats.

Download Book

Learn Python the Right Way is a modern adaption of How to Think Like a Computer Scientist.

More about the Book

How to Think Like a Computer Scientist was already the best introduction to Python book available, but we have republished it to:

  • Use the online IDE Replit instead of showing students how to set up Python on Windows (a point where many aspiring programmers give up).
  • Modernize the presentation and convert the source to Markdown so readers can more easily contribute.
  • Use the online app PythonTutor.com for step-by-step visualisation and stepping through code.

We've also changed the title to better indicate that we believe that this is the best book for beginners to learn Python, not only in the academic context of computer science.

Part 2 of our Python course is codewithrepl.it, a series of Python projects in tutorial form that learners can work through and extend.

We believe that working through first this book (to learn the fundamentals) and then the set of tutorials (to see what is possible and gain experience with various libaries) is the best way to learn Python in 2021.

What is in the Book

  • Chapter 1. The way of the program.

  • Chapter 2.Variables, expressions and statements

  • Chapter 3. Hello, little turtles

  • Chapter 4. Functions.

  • Chapter 5. Conditionals.

  • Chapter 6. Fruitful functions.

  • Chapter 7. Iteration.

  • Chapter 8. Strings.

  • Chapter 9. Tuples.

  • Chapter 10. Event handling.

  • Chapter 11. Lists.

  • Chapter 12. Modules.

  • Chapter 13. Files.

  • Chapter 14. List Algorithms.

  • Chapter 15. Classes and Objects — the Basics.

  • Chapter 16. Classes and Objects — Digging a little deeper.

  • Chapter 17. PyGame.

  • Chapter 18. Recursion.

  • Chapter 19. Exceptions.

  • Chapter 20. Dictionaries.

  • Chapter 21. A Case Study: Indexing your files.

  • Chapter 22. Even more OOP.

  • Chapter 23. Collections of objects.

  • Chapter 24. Inheritance.

  • Chapter 25. Linked lists.

  • Chapter 26. Stacks.

  • Chapter 27. Queues.

  • Chapter 28. Trees.

  • Appendix A.

  • Appendix B.

  • Appendix C.

  • Appendix D.

  • Appendix E.