# Think Python/Index
## Index

| Ackerman function, 6.11 AttributeError, 15.7, A.2.3 Austin, Jane, 13.3 abecedarian, 8.3, 9.2 abs function, 6.1 absolute path, 14.4, 14.11 access, 10.2 accumulator, 10.14 histogram, 13.3 list, 10.7 string, 18.5 sum, 10.7 add method, 17.7 addition with carrying, 7.6 algorithm, 1.2, 1.7, 7.6, 13.7 Euclid, 6.11 MD5, 14.12 RSA, 11.7 square root, 7.9 aliasing, 10.10, 10.11, 10.14, 15.2, 15.6, 17.12 copying to avoid, 10.13 alphabet, 4.12 alternative execution, 5.5 ambiguity, 1.4 anagram, 10.15 anagram set, 12.11, 14.7 and operator, 5.3 anydbm module, 14.6 append method, 10.6, 10.12, 10.15, 18.4, 18.6 arc function, 4.3 argument, 3.1, 3.5, 3.8, 3.8, 3.14, 10.12 gather, 12.4 keyword, 4.5, 4.11, 12.7, 19.2 list, 10.12 optional, 8.8, 10.9, 11.3 variable-length tuple, 12.4 argument scatter, 12.4 arithmetic operator, 2.5 assert statement, 16.5 assignment, 2.11, 7.1, 10.1 item, 8.5, 10.2, 12.1 multiple, 7.8, 11.6 tuple, 12.2, 12.3, 12.5, 12.10 assignment statement, 2.2 attribute __dict__, 17.10 class, 18.2, 18.10 initializing, 17.10 instance, 15.2, 15.8, 18.2, 18.10 available colors, 15.9, 17.12 Bacon, Kevin, 14.12 Bangladesh, national flag, 15.9 Button widget, 19.2 base case, 5.9, 5.13 benchmarking, 13.9, 13.11 big, hairy expression, A.3.2 binding, 19.8, 19.10 bingo, 12.11 birthday, 16.7 birthday paradox, 10.15 bisect module, 10.15 bisection search, 10.15 bisection, debugging by, 7.7 bitwise operator, 2.5 body, 3.5, 3.14, 5.13, 7.3 bool type, 5.2 boolean expression, 5.2, 5.13 boolean function, 6.4, 16.1 boolean operator, 8.9 borrowing, subtraction with, 7.6, 16.4 bound method, 19.6, 19.10 bounding box, 15.9, 19.4, 19.10 bracket squiggly, 11 bracket operator, 8.1, 10.2, 12.1 branch, 5.5, 5.13 break statement, 7.4 bug, 1.3, 1.3, 1.7 worst, 17.12 worst ever, 19.11 Callable object, 19.7 Canvas coordinate, 19.3, 19.8 Canvas item, 19.3 Canvas object, 15.9 Canvas widget, 19.3 Car Talk, 9.7, 9.7, 9.7, 11.10, 12.11 Card class, 18.1 Collatz conjecture, 7.3 Czech Republic, national flag, 15.9 calculator, 1.8, 2.12 call graph, 11.5, 11.9 callback, 19.2, 19.6, 19.7, 19.8, 19.9, 19.10 card, playing, 18 carrying, addition with, 7.6, 16.2, 16.4 case-sensitivity, variable names, 2.10 catch, 14.11 chained conditional, 5.6, 5.13 character, 8.1 checksum, 14.12 child class, 18.7, 18.10 choice function, 13.2 circle function, 4.3 circular definition, 6.5 class, 15.1, 15.8 Card, 18.1 Date, 16.7 Deck, 18.4 Hand, 18.7 Kangaroo, 17.12 Point, 15.1, 17.5 parent, 18.7 Rectangle, 15.3 SimpleTurtleWorld, 19.6 Time, 16.1 class attribute, 18.2, 18.10 class definition, 15.1 class diagram, 18.8, 18.10 class object, 15.1, 15.8 close method, 14.2, 14.6, 14.8 cmp function, 18.3 __cmp__ method, 18.3 colon, 3.5, A.1 color list, 15.9, 17.12 comment, 2.9, 2.11 commutativity, 2.8, 17.8 compare function, 6.1 comparison string, 8.10 tuple, 12.7, 18.3 comparison operator, 5.2 compile, 1.1, 1.7 composition, 3.4, 3.8, 3.14, 6.3, 18.4 compound statement, 5.4, 5.13 compression file, 14.8 concatenation, 2.8, 2.11, 3.9, 8.3, 8.5, 10.9 list, 10.4, 10.12, 10.15 condition, 5.4, 5.13, 7.3, A.2.2 conditional, A.1 chained, 5.6, 5.13 nested, 5.7, 5.13 conditional execution, 5.4 conditional operator, 18.3 conditional statement, 5.4, 5.13, 6.4 config method, 19.3 consistency check, 11.8, 16.4 contributors, 0 conversion type, 3.2 coordinate Canvas, 19.3, 19.8 pixel, 19.8 coordinate sequence, 19.4 copy deep, 15.6 shallow, 15.6 slice, 8.4, 10.5 to avoid aliasing, 10.13 copy module, 15.6 copying objects, 15.6 count method, 8.8 counter, 8.7, 8.12, 11.1, 11.6 counting and looping, 8.7 crosswords, 9.1 cummings, e. e., 1.3.1 cumulative sum, 10.7 Date class, 16.7 Deck class, 18.4 Dijkstra, Edsger, 9.5 Doyle, Arthur Conan, 1.3.4 DSU pattern, 12.7, 12.10, 13.4 data structure, 12.9, 12.10, 13.9 database, 14.6, 14.11, 14.12 datetime module, 16.7 dead code, 6.1, 6.10, A.2.4 debugger (pdb), A.2.3 debugging, 1.3, 1.3, 1.6, 1.7, 2.10, 3.13, 4.10, 5.12, 6.9, 8.11, 9.5, 10.13, 11.8, 12.9, 13.10, 14.10, 15.7, 16.5, 17.10, 18.9, 19.9, A by bisection, 7.7 emotional response, 1.6, A.3.4 experimental, 1.3.4 superstition, A.3.4 deck, playing cards, 18.4 declaration, 11.6, 11.9 decorate-sort-undecorate pattern, 12.7 decrement, 7.2, 7.8 deep copy, 15.6, 15.8 deepcopy function, 15.6 def keyword, 3.5 default value, 13.5, 13.11, 17.5 avoiding mutable, 17.12 definition circular, 6.5 class, 15.1 function, 3.5 recursive, 12.11 del operator, 10.8 deletion, element of list, 10.8 delimiter, 10.9, 10.14 deterministic, 13.2, 13.11 development plan, 4.11 encapsulation and generalization, 4.8 incremental, 6.2, A.1 planned, 16.4 problem recognition, 9.3, 9.4 prototype and patch, 16.2, 16.4 random walk programming, 13.10, A.3.4 diagram call graph, 11.9 class, 18.8, 18.10 object, 15.2, 15.3, 15.6, 15.8, 16.1, 18.2 stack, 3.10, 10.12 state, 2.2, 7.1, 8.11, 10.2, 10.10, 10.11, 11.4, 12.6, 15.2, 15.3, 15.6, 16.1, 18.2 __dict__ attribute, 17.10 dict function, 11 dictionary, 11, 11, 11.9, 12.6, A.2.3 initialize, 12.6 invert, 11.4 lookup, 11.3 looping with, 11.2 reverse lookup, 11.3 subtraction, 13.6 traversal, 12.6, 17.10 dictionary methods anydbm module, 14.6 directory, 14.4, 14.11 walk, 14.4 working, 14.4 dispatch type-based, 17.9 dispatch, type-based, 17.8 divisibility, 5.1 division floating-point, 2.5 floor, 2.5, 5.12 divmod, 12.3, 16.4 docstring, 4.9, 4.11, 15.1 documentation, 1.8 dot notation, 3.3, 3.14, 8.8, 15.2, 17.2, 18.2 double letters, 9.7 drag-and-drop, 19.8 duplicate, 10.15, 10.15, 11.10, 14.12 Einstein, Albert, 4.6 Entry widget, 19.5 Euclid’s algorithm, 6.11 Event object, 19.8 element, 10.1, 10.14 element deletion, 10.8 elif keyword, 5.6 ellipses, 3.5 else keyword, 5.5 email address, 12.2 embedded object, 15.3, 15.8, 17.12 copying, 15.6 emotional debugging, 1.6, A.3.4 empty list, 10.1 empty string, 8.12, 10.9 encapsulation, 4.4, 4.11, 6.3, 7.5, 8.7, 18.7 encode, 18.1, 18.10 encrypt, 18.1 encryption, 11.7 end of line character, 14.10 enumerate function, 12.5 epsilon, 7.5 equality and assignment, 7.1 equivalence, 10.10 equivalent, 10.14 error compile-time, A runtime, 1.3.2, 2.10, 5.10, 5.12, A semantic, 1.3.3, 2.1, 2.10, 8.11, A, A.3 shape, 12.9 syntax, 1.3.1, 2.10, A error checking, 6.8 error message, 1.3.1, 1.3.3, 1.6, 2.1, 2.10, A.1 eval function, 7.9 evaluate, 2.6 event, 19.10 event handler, 19.8 event loop, 19.1, 19.10 event string, 19.8 event-driven programming, 19.2, 19.9, 19.10 exception, 1.3.2, 1.7, 2.10, A, A.2.3 AttributeError, 15.7, A.2.3 IndexError, 8.2, 8.11, 10.2, A.2.3 IOError, 14.5 KeyError, 11, A.2.3 NameError, 3.9, A.2.3 OverflowError, 5.12 RuntimeError, 5.10 SyntaxError, 3.4 TypeError, 8.1, 8.5, 11.4, 12.1, 12.4, 14.3, 17.3, A.2.3 UnboundLocalError, 11.6 ValueError, 5.11, 11.3, 12.2 exception, catching, 14.5 executable, 1.1, 1.7 exercise, secret, 14.12 exists function, 14.4 experimental debugging, 1.3.4, 13.10 expression, 2.5, 2.6, 2.11 big and hairy, A.3.2 boolean, 5.2, 5.13 extend method, 10.6 False special value, 5.2 Fermat’s Last Theorem, 5.14 Frame widget, 19.6 Free Documentation License, GNU, 0, 0 factorial function, 6.5, 6.8 fibonacci function, 6.7, 11.5 file, 14 compression, 14.8 permission, 14.5 reading and writing, 14.2 file object, 9.1, 9.6 filename, 14.4 filter pattern, 10.7, 10.14 find function, 8.6 flag, 11.6, 11.9 float function, 3.2 float type, 2.1 floating-point, 2.11, 7.5 floating-point division, 2.5 floor division, 2.5, 2.11, 5.12 flow of execution, 3.7, 3.14, 6.7, 6.9, 7.3, 18.9, 19.9, A.2.2 flower, 4.12 folder, 14.4 for loop, 4.2, 8.3, 10.3, 12.5 formal language, 1.4, 1.7 format operator, 14.3, 14.11, A.2.3 format sequence, 14.3, 14.11 format string, 14.3, 14.11 frabjuous, 6.5 frame, 3.10, 3.14, 5.9, 6.5, 11.5 frequency, 11.1 letter, 12.11 word, 13.1, 13.12 fruitful function, 3.11, 3.14 frustration, A.3.4 function, 3.5, 3.14, 17.1 abs, 6.1 ack, 6.11 arc, 4.3 choice, 13.2 circle, 4.3 cmp, 18.3 compare, 6.1 deepcopy, 15.6 dict, 11 enumerate, 12.5 eval, 7.9 exists, 14.4 factorial, 6.5 fibonacci, 6.7, 11.5 find, 8.6 float, 3.2 getattr, 17.10 getcwd, 14.4 hasattr, 15.7, 17.10 int, 3.2 isinstance, 6.8, 17.8 len, 3.15, 8.2, 11 list, 10.9 log, 3.3 max, 12.3, 12.4 min, 12.3, 12.4 open, 9.1, 9.1, 14.2, 14.5, 14.6 polygon, 4.3 popen, 14.8 randint, 10.15, 13.2 random, 12.7, 13.2 raw_input, 5.11 recursive, 5.8 reload, 14.9, A.1.1 repr, 14.10 reversed, 12.8 shuffle, 18.6 sorted, 12.8 sqrt, 3.3, 6.2 str, 3.2 sum, 12.4 tuple, 12.1 type, 15.7 zip, 12.5 function argument, 3.8 function call, 3.1, 3.14 function composition, 6.3 function definition, 3.5, 3.6, 3.14, 3.14 function frame, 3.10, 3.14, 5.9, 11.5 function object, 3.5, 3.15 function parameter, 3.8 function syntax, 17.2 function type modifier, 16.3 pure, 16.2 function, fruitful, 3.11 function, math, 3.3 function, reasons for, 3.12 function, trigonometric, 3.3 function, tuple as return value, 12.3 function, void, 3.11 functional programming style, 16.3, 16.6 GCD (greatest common divisor), 6.11 GNU Free Documentation License, 0, 0 GUI, 19.1, 19.10 Gui module, 19.1 gamma function, 6.8 gather, 12.4, 12.10 generalization, 4.5, 4.11, 9.3, 16.4 geometry manager, 19.6, 19.10 get method, 11.1 getattr function, 17.10 getcwd function, 14.4 global statement, 11.6 global variable, 11.6, 11.9 update, 11.6 graphical user interface, 19.1 greatest common divisor (GCD), 6.11 grid, 3.15 guardian pattern, 6.8, 6.10, 8.11 gzip (Unix command), 14.8 HAS-A relationship, 18.8, 18.10 Hand class, 18.7 Hello, World, 1.5 Holmes, Sherlock, 1.3.4 HTMLParser module, 19.11 hanging, A.2.2 hasattr function, 15.7, 17.10 hash function, 11.4, 11.9 hashable, 11.4, 11.9, 12.6 hashtable, 11, 11.9 header, 3.5, 3.14, A.1 help utility, 1.8 hexadecimal, 15.1 high-level language, 1.1, 1.7 histogram, 11.1, 11.1, 11.9 random choice, 13.2, 13.7 word frequencies, 13.3 homophone, 11.10 hyperlink, 19.11 hypotenuse, 6.2 IMDb (Internet Movie Database), 14.12 Image module, 19.11 IndexError, 8.2, 8.11, 10.2, A.2.3 Internet Movie Database (IMDb), 14.12 IOError, 14.5 IS-A relationship, 18.8, 18.10 identical, 10.14 identity, 10.10 if statement, 5.4 image viewer, 19.11 immutability, 8.5, 8.5, 8.12, 10.11, 11.4, 12.1, 12.8 implementation, 11.1, 11.9, 13.9 import statement, 3.14, 4.1, 14.9 in operator, 8.9, 9.3, 10.2, 11 increment, 7.2, 7.8, 16.3, 17.3 incremental development, 6.10, A.1 indentation, 3.5, 17.2, A.1 index, 8.1, 8.1, 8.11, 8.12, 10.2, 10.14, 11, A.2.3 looping with, 9.4, 10.3 negative, 8.2 slice, 8.4, 10.5 starting at zero, 8.1, 10.2 infinite loop, 7.3, 7.8, 19.1, A.2.2, A.2.2 infinite recursion, 5.10, 5.13, 6.8, A.2.2, A.2.2 inheritance, 18.7, 18.10 init method, 17.5, 17.10, 18.1, 18.4, 18.7 initialization (before update), 7.2 instance, 4.1, 4.11, 15.1, 15.8 as argument, 15.2 as return value, 15.4 instance attribute, 15.2, 15.8, 18.2, 18.10 instantiation, 15.1 int function, 3.2 int type, 2.1 integer, 2.11 long, 11.7 interactive mode, 1.1, 1.7, 2.4, 3.11 interface, 4.6, 4.10, 4.11, 18.9 interlocking words, 10.15 interpret, 1.1, 1.7 invariant, 16.5, 16.6, 19.9 invert dictionary, 11.4 invocation, 8.8, 8.12 is operator, 10.10, 15.6 isinstance function, 6.8, 17.8 item, 8.12, 10.1 Canvas, 19.3, 19.10 dictionary, 11.9 item assignment, 8.5, 10.2, 12.1 item update, 10.3 items method, 12.6 iteration, 7, 7.3, 7.8 join method, 10.9, 18.5 Kangaroo class, 17.12 Kevin Bacon Game, 14.12 KeyError, 11, A.2.3 Koch curve, 5.14 key, 11, 11.9 key-value pair, 11, 11.9, 12.6 keyboard input, 5.11 keys method, 11.2 keyword, 2.3, 2.3, 2.11, A.1 def, 3.5 elif, 5.6 else, 5.5 keyword argument, 4.5, 4.11, 12.7, 19.2, 19.10 Label widget, 19.2 Linux, 1.3.4 language formal, 1.4 high-level, 1.1 low-level, 1.1 natural, 1.4 programming, 1.1 safe, 1.3.2 Turing complete, 6.5 leap of faith, 6.6 len function, 3.15, 8.2, 11 letter frequency, 12.11 letter rotation, 8.13, 11.10 lipogram, 9.2 list, 10, 10.9, 10.14, 12.8 as argument, 10.12 comprehension, 10.7 concatenation, 10.4, 10.12, 10.15 copy, 10.5 element, 10.2 empty, 10.1 function, 10.9 index, 10.2 membership, 10.2 method, 10.6 nested, 10.1, 10.3 of objects, 18.4 of tuples, 12.5 operation, 10.4 repetition, 10.4 slice, 10.5 traversal, 10.3, 10.14 | literalness, 1.4 local variable, 3.9, 3.14 log function, 3.3 logarithm, 13.12 logical operator, 5.2, 5.3 long integer, 11.7 lookup, 11.9 lookup, dictionary, 11.3 loop, 4.2, 4.11, 7.3, 12.5 condition, A.2.2 event, 19.1 for, 4.2, 8.3, 10.3 infinite, 7.3, 19.1, A.2.2 nested, 18.4 traversal, 8.3 while, 7.3 looping with dictionaries, 11.2 with indices, 9.4 with strings, 8.7 looping and counting, 8.7 looping with indices, 10.3 low-level language, 1.1, 1.7 ls (Unix command), 14.8 Markov analysis, 13.8 McCloskey, Robert, 8.3 MD5 algorithm, 14.12 Menubutton widget, 19.7 Monty Python and the Holy Grail, 16.2 MP3, 14.12 map pattern, 10.7, 10.14 map to, 18.1 mapping, 10.2, 10.14, 13.8 mash-up, 13.8 math function, 3.3 max function, 12.3, 12.4 membership bisection search, 10.15 dictionary, 11 list, 10.2 set, 11 memo, 11.5, 11.9 mental model, A.3.1 metaphor, method invocation, 17.2 metathesis, 12.11 method, 8.8, 8.12, 17.1, 17.11 __cmp__, 18.3 __str__, 17.6, 18.5 add, 17.7 append, 10.6, 10.12, 18.4, 18.6 close, 14.2, 14.6, 14.8 config, 19.3 count, 8.8 extend, 10.6 get, 11.1 init, 17.5, 18.1, 18.4, 18.7 items, 12.6 join, 10.9, 18.5 keys, 11.2 mro, 18.9 pop, 10.8, 18.6 radd, 17.8 read, 14.8 readline, 9.1, 14.8 remove, 10.8 replace, 13.1 setdefault, 11.4 sort, 10.6, 10.13, 12.7, 18.6 split, 10.9, 12.2 string, 8.13 strip, 9.1, 13.1 translate, 13.1 update, 12.6 values, 11 void, 10.6 method append, 10.15 method resolution order, 18.9 method syntax, 17.2 method, bound, 19.6 method, list, 10.6 min function, 12.3, 12.4 model, mental, A.3.1 modifier, 16.3, 16.6 module, 3.3, 3.14, 3.14 anydbm, 14.6 bisect, 10.15 copy, 15.6 datetime, 16.7 Gui, 19.1 HTMLParser, 19.11 Image, 19.11 os, 14.4 pickle, 14.1, 14.7 pprint, 11.8 profile, 13.9 random, 10.15, 12.7, 13.2, 18.6 reload, 14.9, A.1.1 shelve, 14.7, 14.12 string, 13.1 structshape, 12.9 urllib, 14.12, 19.11 Visual, 17.12 vpython, 17.12 World, 15.9 module object, 3.3, 14.9 module, writing, 14.9 modulus operator, 5.1, 5.13 mro method, 18.9 multiline string, 4.9, A.1 multiple assignment, 7.1, 7.8, 11.6 multiplicity (in class diagram), 18.8, 18.10 mutability, 8.5, 10.2, 10.5, 10.11, 11.6, 12.1, 12.8, 15.5 mutable object, as default value, 17.12 NameError, 3.9, A.2.3 Newton’s method, 7.5 None special value, 3.11, 6.1, 6.10, 10.6, 10.8 natural language, 1.4, 1.7 negative index, 8.2 nested conditional, 5.7, 5.13 nested list, 10.1, 10.3, 10.14 newline, 5.11, 7.1, 18.5 not operator, 5.3 number, random, 13.2 OverflowError, 5.12 object, 8.5, 8.12, 10.10, 10.10, 10.14, 15.1 Callable, 19.7 Canvas, 15.9 class, 15.1 copying, 15.6 Event, 19.8 embedded, 15.3, 15.8, 17.12 file, 9.1, 9.6 function, 3.5, 3.15 module, 14.9 mutable, 15.5 printing, 17.2 object code, 1.1, 1.7 object diagram, 15.2, 15.3, 15.6, 15.8, 16.1, 18.2 object-oriented language, 17.11 object-oriented programming, 17.1, 17.11, 18.7 octal, 2.2 odometer, 9.7 open function, 9.1, 9.1, 14.2, 14.5, 14.6 operand, 2.5, 2.11 operator, 2.11 and, 5.3 bitwise, 2.5 boolean, 8.9 bracket, 8.1, 10.2, 12.1 comparison, 5.2 conditional, 18.3 del, 10.8 format, 14.3, 14.11, A.2.3 in, 8.9, 9.3, 10.2, 11 is, 10.10, 15.6 logical, 5.2, 5.3 modulus, 5.1, 5.13 not, 5.3 or, 5.3 overloading, 17.11 slice, 8.4, 8.13, 10.5, 10.12, 12.1 string, 2.8 update, 10.7 operator overloading, 17.7, 18.3 operator, arithmetic, 2.5 option, 19.2, 19.10 optional argument, 8.8, 10.9, 11.3 optional parameter, 13.5, 17.5 or operator, 5.3 order of operations, 2.7, 2.10, A.3.2 os module, 14.4 other (parameter name), 17.4 overloading, 17.11 override, 13.5, 13.11, 17.5, 18.3, 18.7, 18.9 PEMDAS, 2.7 PIL (Python Imaging Library), 19.11 Point class, 15.1, 17.5 Project Gutenberg, 13.1 Puzzler, 9.7, 9.7, 9.7, 11.10, 12.11 Pythagorean theorem, 6.2 Python 3.0, 1.5, 2.5, 5.11, 11.7, 12.5 Python debugger (pdb), A.2.3 Python Imaging Library (PIL), 19.11 packing widgets, 19.6, 19.10 palindrome, 6.11, 8.13, 9.4, 9.7, 9.7 parameter, 3.8, 3.9, 3.14, 10.12 gather, 12.4 optional, 13.5, 17.5 other, 17.4 self, 17.2 parent class, 18.7, 18.7, 18.10 parentheses argument in, 3.1 empty, 3.5, 8.8 matching, 1.3.1 overriding precedence, 2.7 parameters in, 3.8, 3.9 parent class in, 18.7 tuples in, 12.1 parse, 1.4, 1.7, 14.12 pass statement, 5.4 path, 14.4, 14.11 absolute, 14.4 relative, 14.4 pattern DSU, 12.7, 13.4 decorate-sort-undecorate, 12.7 filter, 10.7, 10.14 guardian, 6.8, 6.10, 8.11 map, 10.7, 10.14 reduce, 10.7, 10.14 search, 8.6, 8.12, 9.3, 11.3 swap, 12.2 pdb (Python debugger), A.2.3 permission, file, 14.5 persistence, 14.1, 14.11 pi, 3.3, 7.9 pickle module, 14.1, 14.7 pickling, 14.7 pie, 4.12 pipe, 14.8, 14.12 pixel coordinate, 19.8 plain text, 9.1, 13.1, 14.12, 19.11 planned development, 16.4, 16.6 playing card, Anglo-American, 18 poetry, 1.4 point, mathematical, 15.1 poker, 18, 18.11 polygon function, 4.3 polymorphism, 17.9, 17.11, 18.9 pop method, 10.8, 18.6 popen function, 14.8 portability, 1.1, 1.7 postcondition, 4.10, 6.9, 18.9 pprint module, 11.8 precedence, 2.11, A.3.2 precondition, 4.10, 4.11, 4.11, 6.9, 10.15, 18.9 prefix, 13.8 pretty print, 11.8 print statement, 1.5, 1.7, 17.6, A.2.4 problem recognition, 9.3, 9.4, 9.6 problem solving, 1, 1.7 profile module, 13.9 program, 1.2, 1.7 program testing, 9.5 programming language, 1.1 prompt, 1.1, 1.7, 5.11 prose, 1.4 prototype and patch, 16.2, 16.4, 16.6 pseudorandom, 13.2, 13.11 pure function, 16.2, 16.6 python.org, 1.8 quotation mark, 1.5, 2.1, 2.1, 4.9, 8.4, A.1 Ramanujan, Srinivasa, 7.9 Rectangle class, 15.3 RSA algorithm, 11.7 RuntimeError, 5.10, 6.8 radd method, 17.8 radian, 3.3 rage, A.3.4 raise statement, 11.3, 16.5 randint function, 10.15, 13.2 random function, 12.7, 13.2 random module, 10.15, 12.7, 13.2, 18.6 random number, 13.2 random text, 13.8 random walk programming, 13.10, A.3.4 rank, 18.1 raw_input function, 5.11 read method, 14.8 readline method, 9.1, 14.8 recursion, 5.8, 5.8, 5.13, 6.5, 6.6 base case, 5.9 infinite, 5.10, 6.8, A.2.2 recursive definition, 6.5, 12.11 reduce pattern, 10.7, 10.14 reducible word, 11.10, 12.11 redundancy, 1.4 refactoring, 4.7, 4.7 reference, 10.11, 10.12, 10.14 aliasing, 10.11 relative path, 14.4, 14.11 reload function, 14.9, A.1.1 remove method, 10.8 repetition, 4.2 list, 10.4 replace method, 13.1 repr function, 14.10 representation, 15.1, 15.3, 18.1 return statement, 5.8, 6.1, A.3.3 return value, 3.1, 3.14, 6.1, 15.4 tuple, 12.3 reverse lookup, dictionary, 11.3, 11.9 reverse word pair, 10.15 reversed function, 12.8 rotation letters, 11.10 rotation, letter, 8.13 rules of precedence, 2.7, 2.11 running pace, 1.8, 2.12, 16.7 runtime error, 1.3.2, 2.10, 5.10, 5.12, A, A.2.3 Scrabble, 12.11 SimpleTurtleWorld class, 19.6 SVG, 19.11 Swampy, 4.1, 9.1, 15.9, 18.11, 19.1 SyntaxError, 3.4 safe language, 1.3.2 sanity check, 11.8 scaffolding, 6.2, 6.10, 11.8 scatter, 12.4, 12.10 script, 1.1, 1.7 script mode, 1.1, 1.7, 2.4, 3.11 search, 11.3 search pattern, 8.6, 8.12, 9.3 search, bisection, 10.15 secret exercise, 14.12 self (parameter name), 17.2 semantic error, 1.3.3, 1.7, 2.1, 2.10, 8.11, A, A.3 semantics, 1.3.3, 1.7, 17.1 sequence, 8.1, 8.12, 10.1, 10.9, 12.1, 12.8 coordinate, 19.4 set, 13.6 anagram, 12.11, 14.7 set membership, 11 setdefault method, 11.4 sexagesimal, 16.4 shallow copy, 15.6, 15.8 shape, 12.10 shape error, 12.9 shell, 14.8 shelve module, 14.7, 14.12 shuffle function, 18.6 sine function, 3.3 singleton, 11.4, 11.9, 12.1 slice, 8.12 copy, 8.4, 10.5 list, 10.5 string, 8.4 tuple, 12.1 update, 10.5 slice operator, 8.4, 8.13, 10.5, 10.12, 12.1 sort method, 10.6, 10.13, 12.7, 18.6 sorted function, 12.8 source code, 1.1, 1.7 special case, 9.5, 9.6, 16.3 special value False, 5.2 None, 3.11, 6.1, 6.10, 10.6, 10.8 True, 5.2 split method, 10.9, 12.2 sqrt, 6.2 sqrt function, 3.3 square root, 7.5 squiggly bracket, 11 stack diagram, 3.10, 3.10, 3.14, 4.12, 5.9, 6.5, 6.11, 10.12 state diagram, 2.2, 2.11, 7.1, 8.11, 10.2, 10.10, 10.11, 11.4, 12.6, 15.2, 15.3, 15.6, 16.1, 18.2 statement, 2.4, 2.11 assert, 16.5 assignment, 2.2, 7.1 break, 7.4 compound, 5.4 conditional, 5.4, 5.13, 6.4 for, 4.2, 8.3, 10.3 global, 11.6 if, 5.4 import, 3.14, 4.1, 14.9 pass, 5.4 print, 1.5, 1.7, 17.6, A.2.4 raise, 11.3, 16.5 return, 5.8, 6.1, A.3.3 try, 14.5 while, 7.3 step size, 8.13 str function, 3.2 __str__ method, 17.6, 18.5 string, 2.1, 2.11, 10.9, 12.8 accumulator, 18.5 comparison, 8.10 empty, 10.9 immutable, 8.5 method, 8.8 multiline, 4.9, A.1 operation, 2.8 slice, 8.4 triple-quoted, 4.9 string method, 8.13 string module, 13.1 string representation, 14.10, 17.6 string type, 2.1 strip method, 9.1, 13.1 structshape module, 12.9 structure, 1.4 subclass, 18.7 subject, 17.2, 17.11, 19.6 subtraction dictionary, 13.6 with borrowing, 7.6 subtraction with borrowing, 16.4 suffix, 13.8 suit, 18.1 sum function, 12.4 superclass, 18.7 superstitious debugging, A.3.4 swap pattern, 12.2 syntax, 1.3.1, 1.3.1, 1.7, 17.1, A.1 syntax error, 1.3.1, 1.7, 2.10, A Tagger, 18.11 Text widget, 19.5 Time class, 16.1 Tkinter, 19.1 True special value, 5.2 Turing complete language, 6.5 Turing Thesis, 6.5 Turing, Alan, 6.5 TurtleWorld, 4.1, 5.14, 18.11 TypeError, 8.1, 8.5, 11.4, 12.1, 12.4, 14.3, 17.3, A.2.3 temporary variable, 6.1, 6.10, A.3.2 test case, minimal, A.2.4 testing and absence of bugs, 9.5 incremental development, 6.2 interactive mode, 1.1 is hard, 9.5 knowing the answer, 6.2 leap of faith, 6.6 minimal test case, A.2.4 text plain, 9.1, 13.1, 14.12, 19.11 random, 13.8 text file, 14.11 token, 1.4, 1.7 traceback, 3.10, 3.14, 5.10, 5.12, 11.3, A.2.3 translate method, 13.1 traversal, 8.3, 8.3, 8.6, 8.11, 8.12, 9.3, 9.3, 10.7, 10.14, 11.1, 11.2, 12.5, 12.5, 12.7, 13.3 dictionary, 17.10 list, 10.3 traverse dictionary, 12.6 triangle, 5.14 trigonometric function, 3.3 triple-quoted string, 4.9 try statement, 14.5 tuple, 12.1, 12.3, 12.8, 12.10 as key in dictionary, 12.6, 13.9 assignment, 12.2 comparison, 12.7, 18.3 in brackets, 12.6 singleton, 12.1 slice, 12.1 tuple assignment, 12.3, 12.5, 12.10 tuple function, 12.1 turtle typewriter, 4.12 type, 2.1, 2.1, 2.11 bool, 5.2 dict, 11 file, 14 float, 2.1 int, 2.1 list, 10 long, 11.7 set, 13.6 str, 2.1 tuple, 12.1 user-defined, 15.1, 16.1 type checking, 6.8 type conversion, 3.2 type function, 15.7 type-based dispatch, 17.8, 17.9, 17.11 typewriter, turtle, 4.12 typographical error, 13.10 UML, 18.8 UnboundLocalError, 11.6 Unix command gzip, 14.8 ls, 14.8 URL, 14.12, 19.11 underscore character, 2.3 uniqueness, 10.15 update, 7.2, 7.5, 7.8 coordinate, 19.8 database, 14.6 global variable, 11.6 histogram, 13.3 item, 10.3 slice, 10.5 update method, 12.6 update operator, 10.7 urllib module, 14.12, 19.11 use before def, 2.10, 3.6 user-defined type, 15.1, 16.1 ValueError, 5.11, 11.3, 12.2 Visual module, 17.12 value, 2.1, 2.11, 10.10, 10.10, 11.9 default, 13.5 tuple, 12.3 values method, 11 variable, 2.2, 2.11 global, 11.6 local, 3.9 temporary, 6.1, 6.10, A.3.2 updating, 7.2 variable-length argument tuple, 12.4 vector graphics, 19.11 veneer, 18.6, 18.10 void function, 3.11, 3.14 void method, 10.6 vpython module, 17.12 World module, 15.9 walk, directory, 14.4 while loop, 7.3 whitespace, 3.13, 5.12, 9.1, 14.10, A.1 widget, 19.1, 19.10 Button, 19.2 Canvas, 19.3 Entry, 19.5 Frame, 19.6 Label, 19.2 Menubutton, 19.7 Text, 19.5 widget, packing, 19.6 word count, 14.9 word frequency, 13.1, 13.12 word, reducible, 11.10, 12.11 working directory, 14.4 worst bug, 17.12 ever, 19.11 Zipf’s law, 13.12 zero, index starting at, 8.1, 10.2 zip function, 12.5 use with dict, 12.6 |