Learn Python The Hard Way | Page 8

Not Available
. . . . . . . .184
Writing Automated Tests For Forms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .185
Extra Credit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .188
Exercise 52: The Start Of Your Web Game189 Refactoring The Exercise 42 Game. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .189
Sessions And Tracking Users. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .194
Creating An Engine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .195
Your Final Exam. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .198
Next Steps 199
Advice From An Old Programmer201 vi

Learn Python The Hard Way, Release 2.0
Welcome to the 2nd Edition of Learn Python the hard way. You can visit the companion site to the book
athttp://learnpythonthehardway.org/where you can purchase digital downloads and paper versions of the
book. The free HTML version of the book is available athttp://learnpythonthehardway.org/book/. CONTENTS
1

Learn Python The Hard Way, Release 2.0
2
CONTENTS

The Hard Way Is Easier
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's the way people usedto teach things.
With the help of this book, you will do the incredibly simple things that all programmers need to do to
learn a language:
1.Go through each exercise.
2.Type in each sample exactly.
3.Make it run.
That's it. This will be verydifcult at rst, but stick with it. If you go through this book, and do each
exercise for one or two hours a night, you will have a good foundation for moving onto another book.
You might not really learn “programming” from this book, but you will learn the foundation skills you
need to start learning the language.
This book's job is to teach you the three most essential skills that a beginning programmer needs to know:
Reading and Writing, Attention to Detail, Spotting Differences.
Reading and Writing
It seems stupidly obvious, but, if you have a problem typing, you will have a problem learning to code.
Especially if you have a problem typing the fairly odd characters in source code. Without this simple
skill you will be unable to learn even the most basic things about how software works.
Typing the code samples and getting them to run will help you learn the names of the symbols, get
familiar with typing them, and get you reading the language.
Attention to Detail
The one skill that separates bad programmers from good programmers is attention to detail. In fact, it's
what separates the good from the bad in any profession. Without paying attention to the tiniest details of 3

Learn Python The Hard Way, Release 2.0
your work, you will miss key elements of what you create. In programming, this is how you end up with
bugs and difcult-to-use systems.
By going through this book, and copying each example exactly, you will be training your brain to focus
on the details of what you are doing, as you are doing it.
Spotting Differences
A very important skill – that most programmers develop over time – is the ability to visually notice
differences between things. An experienced programmer can take two pieces of code that are slightly
different and immediately start pointing out the differences. Programmers have invented tools to make
this even easier, but we won't be using any of these. You rst have to train your brain the hard way, then
you can use the tools.
While you do these exercises, typing each one in, you will be making mistakes. It's inevitable; even
seasoned programmers would make a few. Your job is to compare what you have written to what's
required, and x all the differences. By doing so, you will train yourself to notice mistakes, bugs, and
other problems.
Do Not Copy-Paste
You must typeeach of these exercises in, manually. If you copy and paste, you might as well just not even
do them. The point of these exercises is to train your hands, your brain, and your mind in how to read,
write, and see code. If
Continue reading on your phone by scaning this QR Code

 / 58
Tip: The current page has been bookmarked automatically. If you wish to continue reading later, just open the Dertz Homepage, and click on the 'continue reading' link at the bottom of the page.