Practical Coding in Python

Learn to write and validate your own code

Darren Kessner, PhD

(revised September 1, 2025)

Previous: Practical Coding in Python

Introduction

This book is a practical guide for learning to write code in Python. The structure follows Practical Coding (Java), and in fact the exercises are the same or very similar.

This is meant as a guidebook for self-study, so that you can learn how to use Python to solve the same problems that you can solve with Java.

I emphasize writing unit tests to validate your own code. Writing tests for your own code will give you confidence that your code does what you expect it to. With the development of generative AI, it is easy to generate code to solve any problem in any programming language, and the code may seem to work. However, it is now even more important for software developers to ensure that code behaves as expected.

Rather than reading this book, I recommend that you focus on writing code, i.e. doing the exercises for each chapter. The only way to learn to write code is to actually write code. Each chapter has working code examples that illustrate new syntax or concepts, together with the output from running the code. You will learn much more by struggling with and completing the exercises than by reading the examples.


Next: