Hey, thanks for buying the MEAP edition of Tiny Python Projects: Learn coding and testing with puzzles and games!! This is as close to an “interactive” book as I could make. You see, I want you to be actively involved in learning how to write Python really well by using a process called “test-driven development” (TDD). So, really, you’ll learn two things from this book: how to write Python, and how to use and write tests for your code.
The first chapter describes how to structure a Python program into discrete functions, one of which is dedicated to getting command-line arguments and producing documentation for your program. Because the processing of command-line arguments using the “argparse” module is so central to each exercise, I’ve included an appendix with many examples. The following chapters each describe a coding challenge that you can try your hand at solving and a set of tests that have been provided in a Git repository so you can use the TDD process as you write your code solution. Each chapter is dedicated to some central idea, like how to manipulate a string or list, when and how to use a dictionary, how to use random events, how to write functions and algorithms, etc. As the programs get more complex, I encourage you to write your own functions and the tests for them so that you learn how to become a self-sufficient tester.