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. You can also watch a video version on YouTube.

Download Book

or read online

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

  • Image

    Chapter 1. The way of the program.

  • Image

    Chapter 2.Variables, expressions and statements

  • Image

    Chapter 3. Hello, little turtles

  • Image

    Chapter 4. Functions.

  • Image

    Chapter 5. Conditionals.

  • Image

    Chapter 6. Fruitful functions.

  • Image

    Chapter 7. Iteration.

  • Image

    Chapter 8. Strings.

  • Image

    Chapter 9. Tuples.

  • Image

    Chapter 10. Event handling.

  • Image

    Chapter 11. Lists.

  • Image

    Chapter 12. Modules.

  • Image

    Chapter 13. Files.

  • Image

    Chapter 14. List Algorithms.

  • Image

    Chapter 15. Classes and Objects — the Basics.

  • Image

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

  • Image

    Chapter 17. PyGame.

  • Image

    Chapter 18. Recursion.

  • Image

    Chapter 19. Exceptions.

  • Image

    Chapter 20. Dictionaries.

  • Image

    Chapter 21. A Case Study: Indexing your files.

  • Image

    Chapter 22. Even more OOP.

  • Image

    Chapter 23. Collections of objects.

  • Image

    Chapter 24. Inheritance.

  • Image

    Chapter 25. Linked lists.

  • Image

    Chapter 26. Stacks.

  • Image

    Chapter 27. Queues.

  • Image

    Chapter 28. Trees.

  • Image

    Appendix A.

  • Image

    Appendix B.

  • Image

    Appendix C.

  • Image

    Appendix D.

  • Image

    Appendix E.