Python for Software Design – How to Think Like a Computer Scientist

Free Download

Authors:

ISBN: 978-0-511-50731-1, 978-0-521-89811-9

Size: 1 MB (1177810 bytes)

Pages: 271/271

File format:

Language:

Publishing Year:

Category:

Allen Downey978-0-511-50731-1, 978-0-521-89811-9

Python for Software Design is a concise introduction to software design using the Python programming language. Intended for people with no programming experience, this book starts with the most basic concepts and gradually adds new material. Some of the ideas students find most challenging, like recursion and object-oriented programming, are divided into a sequence of smaller steps and introduced over the course of several chapters. The focus is on the programming process, with special emphasis on debugging. The book includes a wide range of exercises, from short examples to substantial projects, so that students have ample opportunity to practice each new concept. Exercise solutions and code examples are available from thinkpython.com, along with Swampy, a suite of Python programs that is used in some of the exercises.

Table of contents :
Cover……Page 1
Half-title……Page 3
Title……Page 5
Copyright……Page 6
Contents……Page 7
THE STRANGE HISTORY OF THIS BOOK……Page 13
CONTRIBUTOR LIST……Page 15
Python for Software Design……Page 19
1.1 THE PYTHON PROGRAMMING LANGUAGE……Page 21
1.3.1 Syntax Errors……Page 23
1.3.4 Experimental Debugging……Page 24
Exercise 1.1……Page 25
1.5 THE FIRST PROGRAM……Page 26
1.6 DEBUGGING……Page 27
1.7 GLOSSARY……Page 28
Exercise 1.4……Page 29
2.1 VALUES AND TYPES……Page 30
2.2 VARIABLES……Page 31
Exercise 2.1……Page 32
2.4 STATEMENTS……Page 33
2.5 OPERATORS AND OPERANDS……Page 34
2.7 ORDER OF OPERATIONS……Page 35
2.8 STRING OPERATIONS……Page 36
2.10 DEBUGGING……Page 37
2.11 GLOSSARY……Page 38
Exercise 2.3……Page 39
Exercise 2.4……Page 40
3.2 TYPE CONVERSION FUNCTIONS……Page 41
3.3 MATH FUNCTIONS……Page 42
3.4 COMPOSITION……Page 43
3.5 ADDING NEW FUNCTIONS……Page 44
3.7 FLOW OF EXECUTION……Page 46
3.8 PARAMETERS AND ARGUMENTS……Page 47
3.9 VARIABLES AND PARAMETERS ARE LOCAL……Page 48
3.10 STACK DIAGRAMS……Page 49
3.11 FRUITFUL FUNCTIONS AND VOID FUNCTIONS……Page 50
3.13 DEBUGGING……Page 51
3.14 GLOSSARY……Page 52
Exercise 3.4……Page 53
Exercise 3.5……Page 54
4.1 TURTLEWORLD……Page 55
4.2 SIMPLE REPETITION……Page 56
4.3 EXERCISES……Page 57
4.4 ENCAPSULATION……Page 58
4.5 GENERALIZATION……Page 59
4.6 INTERFACE DESIGN……Page 60
4.7 REFACTORING……Page 61
4.8 A DEVELOPMENT PLAN……Page 62
4.10 DEBUGGING……Page 63
Exercise 4.1……Page 64
Exercise 4.4……Page 65
5.2 BOOLEAN EXPRESSIONS……Page 66
5.3 LOGICAL OPERATORS……Page 67
5.5 ALTERNATIVE EXECUTION……Page 68
5.7 NESTED CONDITIONALS……Page 69
5.8 RECURSION……Page 70
5.10 INFINITE RECURSION……Page 72
5.11 KEYBOARD INPUT……Page 73
5.12 DEBUGGING……Page 74
5.13 GLOSSARY……Page 75
Exercise 5.2……Page 76
Exercise 5.4……Page 77
6.1 RETURN VALUES……Page 79
6.2 INCREMENTAL DEVELOPMENT……Page 80
6.3 COMPOSITION……Page 83
Exercise 6.3……Page 84
6.5 MORE RECURSION……Page 85
6.7 ONE MORE EXAMPLE……Page 87
6.8 CHECKING TYPES……Page 88
6.9 DEBUGGING……Page 89
6.10 GLOSSARY……Page 90
Exercise 6.5……Page 91
Exercise 6.8……Page 92
7.1 MULTIPLE ASSIGNMENT……Page 93
7.2 UPDATING VARIABLES……Page 94
7.3 THE while STATEMENT……Page 95
7.4 break……Page 96
7.5 SQUARE ROOTS……Page 97
7.7 DEBUGGING……Page 99
Exercise 7.3……Page 100
Exercise 7.5……Page 101
8.1 A STRING IS A SEQUENCE……Page 102
8.3 TRAVERSAL WITH A for LOOP……Page 103
Exercise 8.1……Page 104
8.4 STRING SLICES……Page 105
8.6 SEARCHING……Page 106
8.8 string METHODS……Page 107
8.10 STRING COMPARISON……Page 109
8.11 DEBUGGING……Page 110
Exercise 8.9……Page 112
Exercise 8.11……Page 113
Exercise 8.12……Page 114
9.1 READING WORD LISTS……Page 115
Exercise 9.2……Page 116
9.3 SEARCH……Page 117
9.4 LOOPING WITH INDICES……Page 119
9.5 DEBUGGING……Page 120
Exercise 9.8……Page 121
Exercise 9.9……Page 122
10.1 A LIST IS A SEQUENCE……Page 123
10.2 LISTS ARE MUTABLE……Page 124
10.3 TRAVERSING A LIST……Page 125
10.5 LIST SLICES……Page 126
10.6 LIST METHODS……Page 127
10.7 MAP, FILTER, AND REDUCE……Page 128
10.8 DELETING ELEMENTS……Page 129
10.9 LISTS AND STRINGS……Page 130
10.10 OBJECTS AND VALUES……Page 131
10.12 LIST ARGUMENTS……Page 133
10.13 DEBUGGING……Page 135
10.14 GLOSSARY……Page 136
Exercise 10.5……Page 137
Exercise 10.10……Page 138
11 Dictionaries……Page 139
11.1 DICTIONARY AS A SET OF COUNTERS……Page 141
Exercise 11.2……Page 142
11.3 REVERSE LOOKUP……Page 143
11.4 DICTIONARIES AND LISTS……Page 144
11.5 MEMOS……Page 146
11.6 GLOBAL VARIABLES……Page 148
11.7 LONG INTEGERS……Page 149
11.8 DEBUGGING……Page 150
Exercise 11.8……Page 151
Exercise 11.10……Page 152
12.1 TUPLES ARE IMMUTABLE……Page 153
12.2 TUPLE ASSIGNMENT……Page 155
12.4 VARIABLE-LENGTH ARGUMENT TUPLES……Page 156
Exercise 12.1……Page 157
12.5 LISTS AND TUPLES……Page 158
12.6 DICTIONARIES AND TUPLES……Page 159
12.7 COMPARING TUPLES……Page 161
12.8 SEQUENCES OF SEQUENCES……Page 162
12.9 DEBUGGING……Page 163
12.10 GLOSSARY……Page 164
Exercise 12.5……Page 165
Exercise 13.2……Page 167
13.2 RANDOM NUMBERS……Page 168
13.3 WORD HISTOGRAM……Page 169
13.4 MOST COMMON WORDS……Page 171
13.6 DICTIONARY SUBTRACTION……Page 172
13.7 RANDOM WORDS……Page 173
13.8 MARKOV ANALYSIS……Page 174
13.9 DATA STRUCTURES……Page 175
13.10 DEBUGGING……Page 177
Exercise 13.9……Page 178
14.2 READING AND WRITING……Page 179
14.3 FORMAT OPERATOR……Page 180
14.4 FILENAMES AND PATHS……Page 181
14.5 CATCHING EXCEPTIONS……Page 183
14.6 DATABASES……Page 184
14.7 PICKLING……Page 185
14.8 PIPES……Page 186
14.9 WRITING MODULES……Page 187
14.10 DEBUGGING……Page 188
Exercise 14.5……Page 189
Exercise 14.7……Page 190
15.1 USER-DEFINED TYPES……Page 192
15.2 ATTRIBUTES……Page 193
15.3 RECTANGLES……Page 194
15.5 OBJECTS ARE MUTABLE……Page 196
15.6 COPYING……Page 197
Exercise 15.3……Page 198
15.8 GLOSSARY……Page 199
Exercise 15.4……Page 200
Exercise 16.1……Page 202
16.2 PURE FUNCTIONS……Page 203
16.3 MODIFIERS……Page 204
16.4 PROTOTYPING VERSUS PLANNING……Page 205
Exercise 16.5……Page 206
16.5 DEBUGGING……Page 207
Exercise 16.8……Page 208
17.1 OBJECT-ORIENTED FEATURES……Page 209
17.2 PRINTING OBJECTS……Page 210
17.4 A MORE COMPLICATED EXAMPLE……Page 212
17.5 THE INIT METHOD……Page 213
17.6 THE METHOD……Page 214
17.8 TYPE-BASED DISPATCH……Page 215
17.9 POLYMORPHISM……Page 217
17.10 DEBUGGING……Page 218
Exercise 17.6……Page 219
Exercise 17.7……Page 220
18.1 CARD OBJECTS……Page 221
18.2 CLASS ATTRIBUTES……Page 222
18.3 COMPARING CARDS……Page 224
18.5 PRINTING THE DECK……Page 225
18.6 ADD, REMOVE, SHUFFLE, AND SORT……Page 226
18.7 INHERITANCE……Page 227
18.8 CLASS DIAGRAMS……Page 229
18.9 DEBUGGING……Page 230
18.10 GLOSSARY……Page 231
Exercise 18.6……Page 232
19.1 GUI……Page 234
19.2 BUTTONS AND CALLBACKS……Page 235
19.3 CANVAS WIDGETS……Page 236
19.4 COORDINATE SEQUENCES……Page 237
19.5 MORE WIDGETS……Page 238
Exercise 19.3……Page 239
19.6 PACKING WIDGETS……Page 240
19.8 BINDING……Page 243
19.9 DEBUGGING……Page 246
19.10 GLOSSARY……Page 247
Exercise 19.4……Page 248
Exercise 19.6……Page 249
A.1 SYNTAX ERRORS……Page 251
A.1.1 I Keep Making Changes and It Makes No Difference……Page 252
A.2.2.1 Infinite Loop……Page 253
A.2.3 When I Run the Program I Get an Exception……Page 254
A.2.4 I Added so Many print Statements I Get Inundated with Output……Page 255
A.3.1 My Program Does not Work……Page 256
A.3.2 I’ve Got A Big Hairy Expression and It Doesn’t Do What I Expect……Page 257
A.3.5 No, I Really Need Help……Page 258
Index……Page 261

Reviews

There are no reviews yet.

Be the first to review “Python for Software Design – How to Think Like a Computer Scientist”
Shopping Cart
Scroll to Top