Preface |
|
vii | |
Acknowledgments |
|
viii | |
About this Book |
|
ix | |
About the author |
|
xii | |
|
|
|
Lesson 1 Why should you learn how to program? |
|
|
3 | (7) |
|
Lesson 2 Basic principles of learning a programming language |
|
|
10 | (15) |
|
Unit 1 VARIABLES, TYPES, EXPRESSIONS, AND STATEMENTS |
|
|
|
Lesson 3 Introducing Python: a programming language |
|
|
25 | (11) |
|
Lesson 4 Variables and expressions: giving names and values to things |
|
|
36 | (10) |
|
Lesson 5 Object types and statements of code |
|
|
46 | (9) |
|
Lesson 6 Capstone project: your first Python program---convert hours to minutes |
|
|
55 | (10) |
|
Unit 2 STRINGS, TUPLES, AND INTERACTING WITH THE USER |
|
|
|
Lesson 7 Introducing string objects: sequences of characters |
|
|
65 | (8) |
|
Lesson 8 Advanced string operations |
|
|
73 | (6) |
|
Lesson 9 Simple error messages |
|
|
79 | (3) |
|
Lesson 10 Tuple objects: sequences of any kind of object |
|
|
82 | (6) |
|
Lesson 11 Interacting with the user |
|
|
88 | (8) |
|
Lesson 12 Capstone project: name mashup |
|
|
96 | (11) |
|
Unit 3 MAKING DECISIONS IN YOUR PROGRAMS |
|
|
|
Lesson 13 Introducing decisions in programs |
|
|
107 | (13) |
|
Lesson 14 Making more-complicated decisions |
|
|
120 | (15) |
|
Lesson 15 Capstone project: choose your own adventure |
|
|
135 | (8) |
|
|
|
Lesson 16 Repeating tasks with loops |
|
|
143 | (9) |
|
Lesson 17 Customizing loops |
|
|
152 | (6) |
|
Lesson 18 Repeating tasks while conditions hold |
|
|
158 | (12) |
|
Lesson 19 Capstone project: Scrabble, Art Edition |
|
|
170 | (13) |
|
Unit 5 ORGANIZING YOUR CODE INTO REUSABLE BLOCKS |
|
|
|
Lesson 20 Building programs to last |
|
|
183 | (11) |
|
Lesson 21 Achieving modularity and abstraction with functions |
|
|
194 | (12) |
|
Lesson 22 Advanced operations with functions |
|
|
206 | (13) |
|
Lesson 23 Capstone project: analyze your friends |
|
|
219 | (16) |
|
Unit 6 WORKING WITH MUTABLE DATATYPES |
|
|
|
Lesson 24 Mutable and immutable objects |
|
|
235 | (7) |
|
Lesson 25 Working with lists |
|
|
242 | (11) |
|
Lesson 26 Advanced operations with lists |
|
|
253 | (8) |
|
Lesson 27 Dictionaries as maps between objects |
|
|
261 | (12) |
|
Lesson 28 Aliasing and copying lists and dictionaries |
|
|
273 | (11) |
|
Lesson 29 Capstone project: document similarity |
|
|
284 | (13) |
|
Unit 7 MAKING YOUR OWN OBJECT TYPES BY USING OBJECT-ORIENTED PROGRAMMING |
|
|
|
Lesson 30 Making your own object types |
|
|
297 | (6) |
|
Lesson 31 Creating a class for an object type |
|
|
303 | (10) |
|
Lesson 32 Working with your own object types |
|
|
313 | (9) |
|
Lesson 33 Customizing classes |
|
|
322 | (8) |
|
Lesson 34 Capstone project: card game |
|
|
330 | (11) |
|
Unit 8 USING LIBRARIES TO ENHANCE YOUR PROGRAMS |
|
|
|
Lesson 35 Useful libraries |
|
|
341 | (11) |
|
Lesson 36 Testing and debugging your programs |
|
|
352 | (10) |
|
Lesson 37 A library for graphical user interfaces |
|
|
362 | (9) |
|
Lesson 38 Capstone project: game of tag |
|
|
371 | (10) |
Appendix A Answers to lesson exercises |
|
381 | (46) |
Appendix B Python cheat sheet |
|
427 | (3) |
Appendix C Interesting Python libraries |
|
430 | (3) |
Index |
|
433 | |