๐ Python Study Book
A beginner-friendly, chapter-by-chapter course through the whole official Python tutorial, written for people who already program in Java or JavaScript and want to know Python properly.
How to use this book
- Read in order. The 16 chapters follow the official tutorial's structure. Each chapter only uses ideas from earlier chapters (or says where an idea is explained).
- Type the examples. Every example was run with Python 3.15 and its output checked.
>>>blocks are for the REPL; file blocks are scripts. Use the Copy button. - Do the exercises. Each chapter has 10+ exercises marked ๐ข easy, ๐ก medium or ๐ด hard, with hidden solutions. Try first, then peek.
- Build the practice project. Exercises marked playground grow the
playground/folder, step by step, into the Chapter 16 expense tracker. The finished version is inplayground/reference/. Start with Using the Playground. - Watch for the โ/๐จ boxes. They compare Python with Java and JavaScript, and point out the habits that cause bugs.
- Test yourself. The Final Assessment draws 50 random questions from a pool of 1000, and scores you per chapter.
- Practise beyond the book. The ๐งฉ Problem Set has 100 language-neutral problems (easy, medium, hard and OOP) with exact tests โ a great way to make Python stick.
๐ก Coming from Java or JavaScript, or rusty on the terminal? Start with Appendix A: From Java & JavaScript to Python for a side-by-side map of the languages, and Appendix B: Terminal, Paths & Text Encoding for the shell basics every Python program relies on.
๐ Setup: install Python 3.15 (Chapter 1 shows how) and check it with python3 --version. Then clone the practice project, coder-hop/python-book-playground, with git clone https://github.com/coder-hop/python-book-playground.git playground. Some examples (match, comprehension unpacking, lazy import, frozendict) won't run on older versions.
Keep practising
๐งฉ 100 Practice Problems
25 easy, 25 medium, 25 hard and 25 object-oriented problems with exact test cases. Start the easy set after Chapter 7 (Tuples, Sets & Dictionaries) and the OOP set after Chapter 11 (Classes). Check with python3 runner/run-tests.py E01 -- python3 e01.py.
๐ ๏ธ How to Solve & Test
Reading stdin and printing stdout in Python, the OOP command-loop template, and the test runner.