-
Notifications
You must be signed in to change notification settings - Fork 0
/
thinkpython2021.html
461 lines (436 loc) · 32.3 KB
/
thinkpython2021.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="generator" content="hevea 2.09">
<link rel="stylesheet" type="text/css" href="thinkpython2.css">
<title>Debugging</title>
</head>
<body>
<a href="thinkpython2020.html"><img src="back.png" ALT="Previous"></a>
<a href="index.html.1"><img src="up.png" ALT="Up"></a>
<a href="thinkpython2022.html"><img src="next.png" ALT="Next"></a>
<hr>
<table>
<tr>
<td valign="top" width="100" bgcolor="#b6459a">
</td>
<td valign="top" width="600" style="padding: 20px 20px;">
<p>
<a href="http:https://amzn.to/1VUYQUU">Buy this book at Amazon.com</a>
<h1 class="chapter" id="sec234">Appendix A  Debugging</h1>
<p>
<a id="hevea_default1726"></a></p><p>When you are debugging, you should distinguish among different
kinds of errors in order to track them down more quickly:</p><ul class="itemize"><li class="li-itemize">Syntax errors are discovered by the interpreter when it is
translating the source code into byte code. They indicate
that there is something wrong with the structure of the program.
Example: Omitting the colon at the end of a <span class="c004">def</span> statement
generates the somewhat redundant message <span class="c004">SyntaxError: invalid
syntax</span>.
<a id="hevea_default1727"></a>
<a id="hevea_default1728"></a></li><li class="li-itemize">Runtime errors are produced by the interpreter if something goes
wrong while the program is running. Most runtime error messages
include information about where the error occurred and what
functions were executing. Example: An infinite recursion eventually
causes the runtime error “maximum recursion depth exceeded”.
<a id="hevea_default1729"></a>
<a id="hevea_default1730"></a>
<a id="hevea_default1731"></a></li><li class="li-itemize">Semantic errors are problems with a program that runs without
producing error messages but doesn’t do the right thing. Example:
An expression may not be evaluated in the order you expect, yielding
an incorrect result.
<a id="hevea_default1732"></a>
<a id="hevea_default1733"></a></li></ul><p>The first step in debugging is to figure out which kind of
error you are dealing with. Although the following sections are
organized by error type, some techniques are
applicable in more than one situation.</p>
<h2 class="section" id="sec235">A.1  Syntax errors</h2>
<p>
<a id="hevea_default1734"></a></p><p>Syntax errors are usually easy to fix once you figure out what they
are. Unfortunately, the error messages are often not helpful.
The most common messages are <span class="c004">SyntaxError: invalid syntax</span> and
<span class="c004">SyntaxError: invalid token</span>, neither of which is very informative.</p><p>On the other hand, the message does tell you where in the program the
problem occurred. Actually, it tells you where Python
noticed a problem, which is not necessarily where the error
is. Sometimes the error is prior to the location of the error
message, often on the preceding line.
<a id="hevea_default1735"></a>
<a id="hevea_default1736"></a></p><p>If you are building the program incrementally, you should have
a good idea about where the error is. It will be in the last
line you added.</p><p>If you are copying code from a book, start by comparing
your code to the book’s code very carefully. Check every character.
At the same time, remember that the book might be wrong, so
if you see something that looks like a syntax error, it might be.</p><p>Here are some ways to avoid the most common syntax errors:
<a id="hevea_default1737"></a></p><ol class="enumerate" type=1><li class="li-enumerate">Make sure you are not using a Python keyword for a variable name.
<a id="hevea_default1738"></a></li><li class="li-enumerate">Check that you have a colon at the end of the header of every
compound statement, including <span class="c004">for</span>, <span class="c004">while</span>,
<span class="c004">if</span>, and <span class="c004">def</span> statements.
<a id="hevea_default1739"></a>
<a id="hevea_default1740"></a></li><li class="li-enumerate">Make sure that any strings in the code have matching
quotation marks. Make sure that all quotation marks are
“straight quotes”, not “curly quotes”.
<a id="hevea_default1741"></a></li><li class="li-enumerate">If you have multiline strings with triple quotes (single or double), make
sure you have terminated the string properly. An unterminated string
may cause an <span class="c004">invalid token</span> error at the end of your program,
or it may treat the following part of the program as a string until it
comes to the next string. In the second case, it might not produce an error
message at all!
<a id="hevea_default1742"></a>
<a id="hevea_default1743"></a></li><li class="li-enumerate">An unclosed opening operator—<code>(</code>, <code>{</code>, or
<code>[</code>—makes Python continue with the next line as part of the
current statement. Generally, an error occurs almost immediately in
the next line.</li><li class="li-enumerate">Check for the classic <span class="c004">=</span> instead of <span class="c004">==</span> inside
a conditional.
<a id="hevea_default1744"></a></li><li class="li-enumerate">Check the indentation to make sure it lines up the way it
is supposed to. Python can handle space and tabs, but if you mix
them it can cause problems. The best way to avoid this problem
is to use a text editor that knows about Python and generates
consistent indentation.
<a id="hevea_default1745"></a>
<a id="hevea_default1746"></a></li><li class="li-enumerate">If you have non-ASCII characters in the code (including strings
and comments), that might cause a problem, although Python 3 usually
handles non-ASCII characters. Be careful if you paste in text from
a web page or other source.</li></ol><p>If nothing works, move on to the next section...</p>
<h3 class="subsection" id="sec236">A.1.1  I keep making changes and it makes no difference.</h3>
<p>If the interpreter says there is an error and you don’t see it, that
might be because you and the interpreter are not looking at the same
code. Check your programming environment to make sure that the
program you are editing is the one Python is trying to run.</p><p>If you are not sure, try putting an obvious and deliberate syntax
error at the beginning of the program. Now run it again. If the
interpreter doesn’t find the new error, you are not running the
new code.</p><p>There are a few likely culprits:</p><ul class="itemize"><li class="li-itemize">You edited the file and forgot to save the changes before
running it again. Some programming environments do this
for you, but some don’t.</li><li class="li-itemize">You changed the name of the file, but you are still running
the old name.</li><li class="li-itemize">Something in your development environment is configured
incorrectly.</li><li class="li-itemize">If you are writing a module and using <span class="c004">import</span>,
make sure you don’t give your module the same name as one
of the standard Python modules.</li><li class="li-itemize">If you are using <span class="c004">import</span> to read a module, remember
that you have to restart the interpreter or use <span class="c004">reload</span>
to read a modified file. If you import the module again, it
doesn’t do anything.
<a id="hevea_default1747"></a>
<a id="hevea_default1748"></a>
<a id="hevea_default1749"></a></li></ul><p>If you get stuck and you can’t figure out what is going on, one
approach is to start again with a new program like “Hello, World!”,
and make sure you can get a known program to run. Then gradually add
the pieces of the original program to the new one.</p>
<h2 class="section" id="sec237">A.2  Runtime errors</h2>
<p>Once your program is syntactically correct,
Python can read it and at least start running it. What could
possibly go wrong?</p>
<h3 class="subsection" id="sec238">A.2.1  My program does absolutely nothing.</h3>
<p>This problem is most common when your file consists of functions and
classes but does not actually invoke a function to start execution.
This may be intentional if you only plan to import this module to
supply classes and functions.</p><p>If it is not intentional, make sure there is a function call
in the program, and make sure the flow of execution reaches
it (see “Flow of Execution” below).</p>
<h3 class="subsection" id="sec239">A.2.2  My program hangs.</h3>
<p>
<a id="hevea_default1750"></a>
<a id="hevea_default1751"></a>
<a id="hevea_default1752"></a></p><p>If a program stops and seems to be doing nothing, it is “hanging”.
Often that means that it is caught in an infinite loop or infinite
recursion.</p><ul class="itemize"><li class="li-itemize">If there is a particular loop that you suspect is the
problem, add a <span class="c004">print</span> statement immediately before the loop that says
“entering the loop” and another immediately after that says
“exiting the loop”.<p>Run the program. If you get the first message and not the second,
you’ve got an infinite loop. Go to the “Infinite Loop” section
below.</p></li><li class="li-itemize">Most of the time, an infinite recursion will cause the program
to run for a while and then produce a “RuntimeError: Maximum
recursion depth exceeded” error. If that happens, go to the
“Infinite Recursion” section below.<p>If you are not getting this error but you suspect there is a problem
with a recursive method or function, you can still use the techniques
in the “Infinite Recursion” section.</p></li><li class="li-itemize">If neither of those steps works, start testing other
loops and other recursive functions and methods.</li><li class="li-itemize">If that doesn’t work, then it is possible that
you don’t understand the flow of execution in your program.
Go to the “Flow of Execution” section below.</li></ul>
<h4 class="subsubsection" id="sec240">Infinite Loop</h4>
<p>
<a id="hevea_default1753"></a>
<a id="hevea_default1754"></a>
<a id="hevea_default1755"></a>
<a id="hevea_default1756"></a></p><p>If you think you have an infinite loop and you think you know
what loop is causing the problem, add a <span class="c004">print</span> statement at
the end of the loop that prints the values of the variables in
the condition and the value of the condition.</p><p>For example:</p><pre class="verbatim">while x > 0 and y < 0 :
# do something to x
# do something to y
print('x: ', x)
print('y: ', y)
print("condition: ", (x > 0 and y < 0))
</pre><p>Now when you run the program, you will see three lines of output
for each time through the loop. The last time through the
loop, the condition should be <span class="c004">False</span>. If the loop keeps
going, you will be able to see the values of <span class="c004">x</span> and <span class="c004">y</span>,
and you might figure out why they are not being updated correctly.</p>
<h4 class="subsubsection" id="sec241">Infinite Recursion</h4>
<p>
<a id="hevea_default1757"></a>
<a id="hevea_default1758"></a></p><p>Most of the time, infinite recursion causes the program to run
for a while and then produce a <span class="c004">Maximum recursion depth exceeded</span>
error.</p><p>If you suspect that a function is causing an infinite
recursion, make sure that there is a base case.
There should be some condition that causes the
function to return without making a recursive invocation.
If not, you need to rethink the algorithm and identify a base
case.</p><p>If there is a base case but the program doesn’t seem to be reaching
it, add a <span class="c004">print</span> statement at the beginning of the function
that prints the parameters. Now when you run the program, you will see
a few lines of output every time the function is invoked,
and you will see the parameter values. If the parameters are not moving
toward the base case, you will get some ideas about why not.</p>
<h4 class="subsubsection" id="sec242">Flow of Execution</h4>
<p>
<a id="hevea_default1759"></a></p><p>If you are not sure how the flow of execution is moving through
your program, add <span class="c004">print</span> statements to the beginning of each
function with a message like “entering function <span class="c004">foo</span>”, where
<span class="c004">foo</span> is the name of the function.</p><p>Now when you run the program, it will print a trace of each
function as it is invoked.</p>
<h3 class="subsection" id="sec243">A.2.3  When I run the program I get an exception.</h3>
<p>
<a id="hevea_default1760"></a>
<a id="hevea_default1761"></a></p><p>If something goes wrong during runtime, Python
prints a message that includes the name of the
exception, the line of the program where the problem occurred,
and a traceback.
<a id="hevea_default1762"></a></p><p>The traceback identifies the function that is currently running, and
then the function that called it, and then the function that called
<em>that</em>, and so on. In other words, it traces the sequence of
function calls that got you to where you are, including the line
number in your file where each call occurred.</p><p>The first step is to examine the place in the program where
the error occurred and see if you can figure out what happened.
These are some of the most common runtime errors:</p><dl class="description"><dt class="dt-description"><span class="c010">NameError:</span></dt><dd class="dd-description"> You are trying to use a variable that doesn’t
exist in the current environment. Check if the name
is spelled right, or at least consistently.
And remember that local variables are local; you
cannot refer to them from outside the function where they are defined.
<a id="hevea_default1763"></a>
<a id="hevea_default1764"></a></dd><dt class="dt-description"><span class="c010">TypeError:</span></dt><dd class="dd-description"> There are several possible causes:
<a id="hevea_default1765"></a>
<a id="hevea_default1766"></a><ul class="itemize"><li class="li-itemize">You are trying to use a value improperly. Example: indexing
a string, list, or tuple with something other than an integer.
<a id="hevea_default1767"></a></li><li class="li-itemize">There is a mismatch between the items in a format string and
the items passed for conversion. This can happen if either the number
of items does not match or an invalid conversion is called for.
<a id="hevea_default1768"></a>
<a id="hevea_default1769"></a></li><li class="li-itemize">You are passing the wrong number of arguments to a function.
For methods, look at the method definition and
check that the first parameter is <span class="c004">self</span>. Then look at the
method invocation; make sure you are invoking the method on an
object with the right type and providing the other arguments
correctly.</li></ul></dd><dt class="dt-description"><span class="c010">KeyError:</span></dt><dd class="dd-description"> You are trying to access an element of a dictionary
using a key that the dictionary does not contain. If the keys
are strings, remember that capitalization matters.
<a id="hevea_default1770"></a>
<a id="hevea_default1771"></a>
<a id="hevea_default1772"></a></dd><dt class="dt-description"><span class="c010">AttributeError:</span></dt><dd class="dd-description"> You are trying to access an attribute or method
that does not exist. Check the spelling! You can use the built-in
function <span class="c004">vars</span> to list the attributes that do exist.
<a id="hevea_default1773"></a>
<a id="hevea_default1774"></a><p>If an AttributeError indicates that an object has <span class="c004">NoneType</span>,
that means that it is <span class="c004">None</span>. So the problem is not the
attribute name, but the object.</p><p>The reason the object is none might be that you forgot
to return a value from a function; if you get to the end of
a function without hitting a <span class="c004">return</span> statement, it returns
<span class="c004">None</span>. Another common cause is using the result from
a list method, like <span class="c004">sort</span>, that returns <span class="c004">None</span>.
<a id="hevea_default1775"></a>
<a id="hevea_default1776"></a></p></dd><dt class="dt-description"><span class="c010">IndexError:</span></dt><dd class="dd-description"> The index you are using
to access a list, string, or tuple is greater than
its length minus one. Immediately before the site of the error,
add a <span class="c004">print</span> statement to display
the value of the index and the length of the array.
Is the array the right size? Is the index the right value?
<a id="hevea_default1777"></a>
<a id="hevea_default1778"></a></dd></dl><p>The Python debugger (<span class="c004">pdb</span>) is useful for tracking down
exceptions because it allows you to examine the state of the
program immediately before the error. You can read
about <span class="c004">pdb</span> at <a href="https://docs.python.org/3/library/pdb.html"><span class="c004">https://docs.python.org/3/library/pdb.html</span></a>.
<a id="hevea_default1779"></a>
<a id="hevea_default1780"></a></p>
<h3 class="subsection" id="sec244">A.2.4  I added so many <span class="c004">print</span> statements I get inundated with
output.</h3>
<p>
<a id="hevea_default1781"></a>
<a id="hevea_default1782"></a></p><p>One of the problems with using <span class="c004">print</span> statements for debugging
is that you can end up buried in output. There are two ways
to proceed: simplify the output or simplify the program.</p><p>To simplify the output, you can remove or comment out <span class="c004">print</span>
statements that aren’t helping, or combine them, or format
the output so it is easier to understand.</p><p>To simplify the program, there are several things you can do. First,
scale down the problem the program is working on. For example, if you
are searching a list, search a <em>small</em> list. If the program takes
input from the user, give it the simplest input that causes the
problem.
<a id="hevea_default1783"></a></p><p>Second, clean up the program. Remove dead code and reorganize the
program to make it as easy to read as possible. For example, if you
suspect that the problem is in a deeply nested part of the program,
try rewriting that part with simpler structure. If you suspect a
large function, try splitting it into smaller functions and testing them
separately.
<a id="hevea_default1784"></a>
<a id="hevea_default1785"></a></p><p>Often the process of finding the minimal test case leads you to the
bug. If you find that a program works in one situation but not in
another, that gives you a clue about what is going on.</p><p>Similarly, rewriting a piece of code can help you find subtle
bugs. If you make a change that you think shouldn’t affect the
program, and it does, that can tip you off.</p>
<h2 class="section" id="sec245">A.3  Semantic errors</h2>
<p>In some ways, semantic errors are the hardest to debug,
because the interpreter provides no information
about what is wrong. Only you know what the program is supposed to
do.
<a id="hevea_default1786"></a>
<a id="hevea_default1787"></a></p><p>The first step is to make a connection between the program
text and the behavior you are seeing. You need a hypothesis
about what the program is actually doing. One of the things
that makes that hard is that computers run so fast.</p><p>You will often wish that you could slow the program down to human
speed, and with some debuggers you can. But the time it takes to
insert a few well-placed <span class="c004">print</span> statements is often short compared to
setting up the debugger, inserting and removing breakpoints, and
“stepping” the program to where the error is occurring.</p>
<h3 class="subsection" id="sec246">A.3.1  My program doesn’t work.</h3>
<p>You should ask yourself these questions:</p><ul class="itemize"><li class="li-itemize">Is there something the program was supposed to do but
which doesn’t seem to be happening? Find the section of the code
that performs that function and make sure it is executing when
you think it should.</li><li class="li-itemize">Is something happening that shouldn’t? Find code in
your program that performs that function and see if it is
executing when it shouldn’t.</li><li class="li-itemize">Is a section of code producing an effect that is not
what you expected? Make sure that you understand the code in
question, especially if it involves functions or methods in
other Python modules. Read the documentation for the functions you call.
Try them out by writing simple test cases and checking the results.</li></ul><p>In order to program, you need a mental model of how
programs work. If you write a program that doesn’t do what you expect,
often the problem is not in the program; it’s in your mental
model.
<a id="hevea_default1788"></a>
<a id="hevea_default1789"></a></p><p>The best way to correct your mental model is to break the program
into its components (usually the functions and methods) and test
each component independently. Once you find the discrepancy
between your model and reality, you can solve the problem.</p><p>Of course, you should be building and testing components as you
develop the program. If you encounter a problem,
there should be only a small amount of new code
that is not known to be correct.</p>
<h3 class="subsection" id="sec247">A.3.2  I’ve got a big hairy expression and it doesn’t
do what I expect.</h3>
<p>
<a id="hevea_default1790"></a>
<a id="hevea_default1791"></a></p><p>Writing complex expressions is fine as long as they are readable,
but they can be hard to debug. It is often a good idea to
break a complex expression into a series of assignments to
temporary variables.</p><p>For example:</p><pre class="verbatim">self.hands[i].addCard(self.hands[self.findNeighbor(i)].popCard())
</pre><p>This can be rewritten as:</p><pre class="verbatim">neighbor = self.findNeighbor(i)
pickedCard = self.hands[neighbor].popCard()
self.hands[i].addCard(pickedCard)
</pre><p>The explicit version is easier to read because the variable
names provide additional documentation, and it is easier to debug
because you can check the types of the intermediate variables
and display their values.
<a id="hevea_default1792"></a>
<a id="hevea_default1793"></a></p><p>Another problem that can occur with big expressions is
that the order of evaluation may not be what you expect.
For example, if you are translating the expression
<span class="c009">x</span>/2 π into Python, you might write:</p><pre class="verbatim">y = x / 2 * math.pi
</pre><p>That is not correct because multiplication and division have
the same precedence and are evaluated from left to right.
So this expression computes <span class="c009">x</span> π / 2.
<a id="hevea_default1794"></a>
<a id="hevea_default1795"></a></p><p>A good way to debug expressions is to add parentheses to make
the order of evaluation explicit:</p><pre class="verbatim"> y = x / (2 * math.pi)
</pre><p>Whenever you are not sure of the order of evaluation, use
parentheses. Not only will the program be correct (in the sense
of doing what you intended), it will also be more readable for
other people who haven’t memorized the order of operations.</p>
<h3 class="subsection" id="sec248">A.3.3  I’ve got a function that doesn’t return what I
expect.</h3>
<p>
<a id="hevea_default1796"></a>
<a id="hevea_default1797"></a></p><p>If you have a <span class="c004">return</span> statement with a complex expression,
you don’t have a chance to print the result before
returning. Again, you can use a temporary variable. For
example, instead of:</p><pre class="verbatim">return self.hands[i].removeMatches()
</pre><p>you could write:</p><pre class="verbatim">count = self.hands[i].removeMatches()
return count
</pre><p>Now you have the opportunity to display the value of
<span class="c004">count</span> before returning.</p>
<h3 class="subsection" id="sec249">A.3.4  I’m really, really stuck and I need help.</h3>
<p>First, try getting away from the computer for a few minutes.
Computers emit waves that affect the brain, causing these
symptoms:</p><ul class="itemize"><li class="li-itemize">Frustration and rage.
<a id="hevea_default1798"></a>
<a id="hevea_default1799"></a>
<a id="hevea_default1800"></a>
<a id="hevea_default1801"></a></li><li class="li-itemize">Superstitious beliefs (“the computer hates me”) and
magical thinking (“the program only works when I wear my
hat backward”).
<a id="hevea_default1802"></a>
<a id="hevea_default1803"></a></li><li class="li-itemize">Random walk programming (the attempt to program by writing
every possible program and choosing the one that does the right
thing).
<a id="hevea_default1804"></a>
<a id="hevea_default1805"></a></li></ul><p>If you find yourself suffering from any of these symptoms, get
up and go for a walk. When you are calm, think about the program.
What is it doing? What are some possible causes of that
behavior? When was the last time you had a working program,
and what did you do next?</p><p>Sometimes it just takes time to find a bug. I often find bugs
when I am away from the computer and let my mind wander. Some
of the best places to find bugs are trains, showers, and in bed,
just before you fall asleep.</p>
<h3 class="subsection" id="sec250">A.3.5  No, I really need help.</h3>
<p>It happens. Even the best programmers occasionally get stuck.
Sometimes you work on a program so long that you can’t see the
error. You need a fresh pair of eyes.</p><p>Before you bring someone else in, make sure you are prepared.
Your program should be as simple
as possible, and you should be working on the smallest input
that causes the error. You should have <span class="c004">print</span> statements in the
appropriate places (and the output they produce should be
comprehensible). You should understand the problem well enough
to describe it concisely.</p><p>When you bring someone in to help, be sure to give
them the information they need:</p><ul class="itemize"><li class="li-itemize">If there is an error message, what is it
and what part of the program does it indicate?</li><li class="li-itemize">What was the last thing you did before this error occurred?
What were the last lines of code that you wrote, or what is
the new test case that fails?</li><li class="li-itemize">What have you tried so far, and what have you learned?</li></ul><p>When you find the bug, take a second to think about what you
could have done to find it faster. Next time you see something
similar, you will be able to find the bug more quickly.</p><p>Remember, the goal is not just to make the program
work. The goal is to learn how to make the program work.</p>
<p>
<a href="http:https://amzn.to/1VUYQUU">Buy this book at Amazon.com</a>
</td>
<td width=130 valign="top">
<p>
<h4>Are you using one of our books in a class?</h4> We'd like to know
about it. Please consider filling out <a href="http:https://spreadsheets.google.com/viewform?formkey=dC0tNUZkMjBEdXVoRGljNm9FRmlTMHc6MA" onClick="javascript: pageTracker._trackPageview('/outbound/survey');">this short survey</a>.
<p>
<br>
<p>
<a rel="" href="http:https://www.amazon.com/gp/product/1491938455/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1491938455&linkCode=as2&tag=greenteapre01-20&linkId=2JJH4SWCAVVYSQHO">Think DSP</a><img class="c003" src="http:https://ir-na.amazon-adsystem.com/e/ir?t=greenteapre01-20&l=as2&o=1&a=1491938455" width="1" height="1" border="0" alt="">
<p>
<a rel="" href="http:https://www.amazon.com/gp/product/1491938455/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1491938455&linkCode=as2&tag=greenteapre01-20&linkId=CTV7PDT7E5EGGJUM"><img border="0" src="http:https://ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&ASIN=1491938455&Format=_SL160_&ID=AsinImage&MarketPlace=US&ServiceVersion=20070822&WS=1&tag=greenteapre01-20"></a><img class="c003" src="http:https://ir-na.amazon-adsystem.com/e/ir?t=greenteapre01-20&l=as2&o=1&a=1491938455" width="1" height="1" border="0" alt="">
<p>
<a rel="" href="http:https://www.amazon.com/gp/product/1491929561/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1491929561&linkCode=as2&tag=greenteapre01-20&linkId=ZY6MAYM33ZTNSCNZ">Think Java</a><img class="c003" src="http:https://ir-na.amazon-adsystem.com/e/ir?t=greenteapre01-20&l=as2&o=1&a=1491929561" width="1" height="1" border="0" alt="">
<p>
<a rel="" href="http:https://www.amazon.com/gp/product/1491929561/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1491929561&linkCode=as2&tag=greenteapre01-20&linkId=PT77ANWARUNNU3UK"><img border="0" src="http:https://ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&ASIN=1491929561&Format=_SL160_&ID=AsinImage&MarketPlace=US&ServiceVersion=20070822&WS=1&tag=greenteapre01-20"></a><img class="c003" src="http:https://ir-na.amazon-adsystem.com/e/ir?t=greenteapre01-20&l=as2&o=1&a=1491929561" width="1" height="1" border="0" alt="">
<p>
<a href="http:https://www.amazon.com/gp/product/1449370780/ref=as_li_qf_sp_asin_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1449370780&linkCode=as2&tag=greenteapre01-20">Think Bayes</a><img class="c003" src="http:https://ir-na.amazon-adsystem.com/e/ir?t=greenteapre01-20&l=as2&o=1&a=1449370780" width="1" height="1" border="0" alt="">
<p>
<a href="http:https://www.amazon.com/gp/product/1449370780/ref=as_li_qf_sp_asin_il?ie=UTF8&camp=1789&creative=9325&creativeASIN=1449370780&linkCode=as2&tag=greenteapre01-20"><img border="0" src="http:https://ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&ASIN=1449370780&Format=_SL160_&ID=AsinImage&MarketPlace=US&ServiceVersion=20070822&WS=1&tag=greenteapre01-20"></a><img class="c003" src="http:https://ir-na.amazon-adsystem.com/e/ir?t=greenteapre01-20&l=as2&o=1&a=1449370780" width="1" height="1" border="0" alt="">
<p>
<a rel="" href="http:https://www.amazon.com/gp/product/1491939362/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1491939362&linkCode=as2&tag=greenteapre01-20&linkId=FJKSQ3IHEMY2F2VA">Think Python 2e</a><img class="c003" src="http:https://ir-na.amazon-adsystem.com/e/ir?t=greenteapre01-20&l=as2&o=1&a=1491939362" width="1" height="1" border="0" alt="">
<p>
<a rel="" href="http:https://www.amazon.com/gp/product/1491939362/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1491939362&linkCode=as2&tag=greenteapre01-20&linkId=ZZ454DLQ3IXDHNHX"><img border="0" src="http:https://ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&ASIN=1491939362&Format=_SL160_&ID=AsinImage&MarketPlace=US&ServiceVersion=20070822&WS=1&tag=greenteapre01-20"></a><img class="c003" src="http:https://ir-na.amazon-adsystem.com/e/ir?t=greenteapre01-20&l=as2&o=1&a=1491939362" width="1" height="1" border="0" alt="">
<p>
<a href="http:https://www.amazon.com/gp/product/1491907339/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1491907339&linkCode=as2&tag=greenteapre01-20&linkId=O7WYM6H6YBYUFNWU">Think Stats 2e</a><img class="c003" src="http:https://ir-na.amazon-adsystem.com/e/ir?t=greenteapre01-20&l=as2&o=1&a=1491907339" width="1" height="1" border="0" alt="">
<p>
<a href="http:https://www.amazon.com/gp/product/1491907339/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1491907339&linkCode=as2&tag=greenteapre01-20&linkId=JVSYKQHYSUIEYRHL"><img border="0" src="http:https://ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&ASIN=1491907339&Format=_SL160_&ID=AsinImage&MarketPlace=US&ServiceVersion=20070822&WS=1&tag=greenteapre01-20"></a><img class="c003" src="http:https://ir-na.amazon-adsystem.com/e/ir?t=greenteapre01-20&l=as2&o=1&a=1491907339" width="1" height="1" border="0" alt="">
<p>
<a href="http:https://www.amazon.com/gp/product/1449314635/ref=as_li_tf_tl?ie=UTF8&tag=greenteapre01-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=1449314635">Think Complexity</a><img class="c003" src="http:https://www.assoc-amazon.com/e/ir?t=greenteapre01-20&l=as2&o=1&a=1449314635" width="1" height="1" border="0" alt="">
<p>
<a href="http:https://www.amazon.com/gp/product/1449314635/ref=as_li_tf_il?ie=UTF8&camp=1789&creative=9325&creativeASIN=1449314635&linkCode=as2&tag=greenteapre01-20"><img border="0" src="http:https://ws-na.amazon-adsystem.com/widgets/q?_encoding=UTF8&ASIN=1449314635&Format=_SL160_&ID=AsinImage&MarketPlace=US&ServiceVersion=20070822&WS=1&tag=greenteapre01-20"></a><img class="c003" src="http:https://www.assoc-amazon.com/e/ir?t=greenteapre01-20&l=as2&o=1&a=1449314635" width="1" height="1" border="0" alt="">
</td>
</tr>
</table>
<hr>
<a href="thinkpython2020.html"><img src="back.png" ALT="Previous"></a>
<a href="index.html.1"><img src="up.png" ALT="Up"></a>
<a href="thinkpython2022.html"><img src="next.png" ALT="Next"></a>
</body>
</html>