-
PrefaceThis simple book is meant to get you started in programming. The title says it's the hard way to learn to write code bu
-
The Hard Way Is EasierWith the help of this book, you will do the incredibly simple things that all programmers do to learn a programming lang
-
Ex0: The SetupThis exercise has no code. It is simply the exercise you complete to get your computer to run Python. You should foll
-
Ex1: A Good First ProgramWarning If you skipped Exercise 0 then you are not doing this book right. You must read every single thing I write here
-
Ex2: Comments And Pound CharactersComments are very important in your programs. They are used to tell you what something does in English, and they are us
-
Ex3: Numbers And MathEvery programming language has some kind of way of doing numbers and math. Do not worry: programmers lie frequently abo
-
Ex4: Variables And NamesNow you can print things with print and you can do math. The next step is to learn about variables. In programming a v
-
Ex5: More Variables And PrintingNow we'll do even more typing of variables and printing them out. This time we'll use something called a "format string
-
Ex6: Strings And TextWhile you have been writing strings, you still do not know what they do. In this exercise we create a bunch of variable
-
Ex7: More PrintingNow we are going to do a bunch of exercises where you just type code in and make it run. I won't be explaining this exe
-
Ex8: Printing, PrintingWe will now see how to do a more complicated formatting of a string. This code looks complex, but if you do your commen
-
Ex9: Printing, Printing, PrintingBy now you should realize the pattern for this book is to use more than one exercise to teach you something new. I start
-
Ex10: What Was That?In Exercise 9 I threw you some new stuff, just to keep you on your toes. I showed you two ways to make a string that go
-
Ex11: Asking QuestionsNow it is time to pick up the pace. You are doing a lot of printing to get you familiar with typing simple things, but
-
Ex12: Prompting PeopleWhen you typed raw_input() you were typing the ( and ) characters, which are parenthesis characters. This is similar to
-
Ex13: Parameters, Unpacking, VariablesIn this exercise we will cover one more input method you can use to pass variables to a script (script being another nam
-
Ex14: Prompting And PassingLet's do one exercise that uses argv and raw_input together to ask the user something specific. You will need this for
-
Ex15: Reading FilesYou know how to get input from a user with raw_input or argv. Now you will learn about reading from a file. You may ha
-
Ex16: Reading And Writing FilesIf you did the Study Drills from the last exercise you should have seen all sorts of commands (methods/functions) you ca
-
Ex17: More FilesNow let's do a few more things with files. We'll write a Python script to copy one file to another. It'll be very shor
-
Ex18: Names, Variables, Code, FunctionsBig title, right? I am about to introduce you to the function! Dum dum dah! Every programmer will go on and on about
-
Ex19: Functions And VariablesFunctions may have been a mind-blowing amount of information, but do not worry. Just keep doing these exercises and goi
-
Ex20: Functions And FilesRemember your checklist for functions, then do this exercise paying close attention to how functions and files can work
-
Ex21: Functions Can Return SomethingYou have been using the = character to name variables and set them to numbers or strings. We're now going to blow your
-
Ex22: What Do You Know So Far?There won't be any code in this exercise or the next one, so there's no What You Should See or Study Drills either. In
-
Ex23: Read Some CodeYou should have spent the last week getting your list of symbols straight and locked in your mind. Now you get to apply
-
Ex24: More PracticeYou are getting to the end of this section. You should have enough Python "under your fingers" to move on to learning ab
-
Ex25: Even More PracticeWe're going to do some more practice involving functions and variables to make sure you know them well. This exercise s
-
Ex26: Congratulations, Take A Test!You are almost done with the first half of the book. The second half is where things get interesting. You will learn lo
-
Ex27: Memorizing LogicToday is the day you start learning about logic. Up to this point you have done everything you possibly can reading and
-
Ex28: Boolean PracticeThe logic combinations you learned from the last exercise are called "boolean" logic expressions. Boolean logic is used
-
Ex29: What IfHere is the next script of Python you will enter, which introduces you to the if-statement. Type this in, make it run e
-
Ex30: Else And IfIn the last exercise you worked out some if-statement and then tried to guess what they are and how they work. Before y
-
Ex31: Making DecisionsIn the first half of this book you mostly just printed out things called functions, but everything was basically in a st
-
Ex32: Loops And ListsYou should now be able to do some programs that are much more interesting. If you have been keeping up, you should real
-
Ex33: While LoopsNow to totally blow your mind with a new loop, the while-loop. A while-loop will keep executing the code block under it
-
Ex34: Accessing Elements Of ListsLists are pretty useful, but unless you can get at the things in them they aren't all that good. You can already go thr
-
Ex35: Branches and FunctionsYou have learned if-statements, functions, and lists. Now it's time to bend your mind. Type this in, and see if you ca
-
Ex36: Designing and DebuggingNow that you know if-statements, I'm going to give you some rules for for-loops and while-loops that will keep you out o
-
Ex37: Symbol ReviewIt's time to review the symbols and Python words you know and to try to pick up a few more for the next few lessons. I
-
Ex38: Doing Things To ListsYou have learned about lists. When you learned about while-loops you "appended" numbers to the end of a list and printed
-
Ex39: Dictionaries, Oh Lovely DictionariesYou are now going to learn about the Dictionary data structure in Python. A Dictionary (or "dict") is a way to store da
-
Ex40: Modules, Classes, And ObjectsYou know how a dictionary is created and used and that it is a way to map one thing to another. That means if you have
-
Ex41: Learning To Speak Object OrientedIn this exercise I'm going to teach you how to speak "object oriented." What I'll do is give you a small set of words w
-
Ex42: Is-A, Has-A, Objects, and ClassesAn important concept that you have to understand is the difference between a class and an object. The problem is, there
-
Ex43: Gothons From Planet Percal #25I'm going to describe a process to use when you want to build something using Python, specifically with object-oriented
-
Ex44: Inheritance Vs. CompositionIn the fairy tales about heroes defeating evil villains there's always a dark forest of some kind. It could be a cave,
-
Ex45: You Make A GameYou need to start learning to feed yourself. Hopefully as you have worked through this book, you have learned that all
-
Ex46: A Project SkeletonThis will be where you start learning how to set up a good project "skeleton" directory. This skeleton directory will h
-
Ex47: Automated TestingHaving to type commands into your game over and over to make sure it's working is annoying. Wouldn't it be better to wr
-
Ex48: Advanced User InputIn past games you handled the user's input by simply expecting set strings. If the user typed "run", and exactly "run",
-
Ex49: Making SentencesWhat we should be able to get from our little game lexicon scanner is a list that looks like this: Python 2.7.11 (defaul
-
Ex50: Your First WebsiteThese final three exercises will be very hard and you should take your time with them. In this first one you'll build a
-
Ex51: Getting Input From A BrowserWhile it's exciting to see the browser display "Hello World," it's even more exciting to let the user submit text to you
-
Ex52: The Start Of Your Web GameWe're coming to the end of the book, and in this exercise I'm going to really challenge you. When you're done, you'll b
-
Advice From An Old ProgrammerYou've finished this book and have decided to continue with programming. Maybe it will be a career for you, or maybe it
-
Next StepsYou're not a programmer quite yet. I like to think of this book as giving you your "programming black belt." You know
-
Appendix A: Command Line Crash CourseAppendix A: Command Line Crash Course This appendix is a quick super fast course in using the command line. It is inten