Preface

This simple book is meant to get you started in programming. The title says it's the hard way to learn to write code, but it's actually not. It's only the "hard" way because it uses a technique called instruction. Instruction is where I tell you to do a sequence of controlled exercises designed to build a skill through repetition. This technique works very well with beginners who know nothing and need to acquire basic skills before they can understand more complex topics. It's used in everything from martial arts to music to even basic math and reading skills.

This book instructs you in Python by slowly building and establishing skills through techniques such as practice and memorization, then applying them to increasingly difficult problems. By the end of the book you will have the tools needed to begin learning more complex programming topics. I like to tell people that my book gives you your "programming black belt." What this means is that you know the basics well enough to now start learning programming.

If you work hard, take your time, and build these skills, you will learn to code.

Improvements in the First Edition for Python 3

This first edition for Python 3 of Learn Python The Hard Way now uses Python 3.6. I've standardized on this version of Python because it has a new improved string formatting system that is easier to use than the previous 4 (or 3, I forget, there were many). There are a few problems with Python 3.6 for beginners, but I'll be helping you navigate these issues in the book. A particularly hairy problem is Python 3.6 has very poor error messages in some key areas that I'll be helping you understand.

I have also improved the videos based on my experiences over the last five years teaching people Python. In the past the videos simply let you watch me do the exercise. The fourth edition videos also show you how to break---and then fix---every exercise. This skill is called "debugging." It will teach you how to fix problems you run into but also how Python runs the programs you're creating. The goal of this new methodology is to build a mental model of how Python runs your code so you can more easily figure out why it's broken. You'll also learn many useful tricks for debugging broken software.

Lastly, the fourth edition fully supports Microsoft Windows 10 from beginning to end. The previous edition focused mostly on the Unix style systems such as macOS and Linux, with Windows being more of an afterthought. At the time I started writing the fourth edition Microsoft had started to take open source tools and developers seriously, and it was difficult to ignore them as a serious Python development platform. The videos will feature Microsoft windows using Python in various scenarios and will also show macOS and Linux for full compatibility. I'll tell you about any gotchas on each platform, cover installation instructions, and provide any other tips I can give you.

Acknowledgements

I would like to thank Angela for helping me with the first two versions of this book. Without her I probably wouldn't have bothered to finish it at all. She did the copy-editing of the first draft and supported me immensely while I wrote it.

I'd also like to thank Greg Newman for doing the original cover art, Brian Shumate for early website designs, and all of the people who read this book and took the time to send me feedback and corrections.

Thank you.

Buy Learn Python the Hard Way, 5th Edition

When you buy Learn Python the Hard Way, 5th Edition directly from the author, Zed A. Shaw, you'll get access to the digital content for all 60 exercises, plus all 60+ videos that are normally sold separately. You'll also have access to direct help from Zed via Discord chat and live streams on special topics when I have time.

$29

Buy Learn Python The Hard Way, 5th Edition

Learn JavaScript the Hard Way

If you want to learn to be a Web Developer then my new Learn JavaScript the Hard Way course is a great choice. It's currently out as an Early Access release and already has more content than the Python Course, with even more content coming at a 80% discount from the final price.

Buy Learn JavaScript the Hard Way