About the Author |
|
xiii | |
About the Technical Reviewer |
|
xv | |
Acknowledgments |
|
xvii | |
Introduction |
|
xix | |
Chapter 1 Introduction to Computer Programming and Python |
|
1 | (16) |
|
Programming Language Overview |
|
|
2 | (1) |
|
|
2 | (1) |
|
How Does Python Differ from Other Programming Languages? |
|
|
3 | (1) |
|
|
3 | (2) |
|
Examples of Python in the Wild |
|
|
5 | (1) |
|
Your First Python Program |
|
|
6 | (1) |
|
|
7 | (8) |
|
Installing Python on Windows |
|
|
7 | (8) |
|
Installing Python on Other Operating Systems |
|
|
15 | (1) |
|
|
16 | (1) |
Chapter 2 It All Adds Up |
|
17 | (20) |
|
|
18 | (4) |
|
Data Types: Know Your Enemy |
|
|
22 | (3) |
|
Converting Number Data Types |
|
|
25 | (1) |
|
|
26 | (3) |
|
Super Hero Generator 3000 |
|
|
29 | (4) |
|
|
33 | (4) |
Chapter 3 String Things Along |
|
37 | (22) |
|
Leave Your Comments at the Door |
|
|
37 | (4) |
|
|
39 | (1) |
|
|
40 | (1) |
|
Other Uses for Commenting |
|
|
40 | (1) |
|
Texting - Without Your Phone |
|
|
41 | (18) |
|
Working with Strings and Variables |
|
|
43 | (2) |
|
|
45 | (1) |
|
Strings on Multiple Lines |
|
|
46 | (1) |
|
|
46 | (3) |
|
Introducing a New Weapon to Your Arsenal: Lists |
|
|
49 | (3) |
|
|
52 | (2) |
|
|
54 | (2) |
|
|
56 | (3) |
Chapter 4 Making Decisions |
|
59 | (22) |
|
|
60 | (1) |
|
|
61 | (20) |
|
Behold - The If Statement! |
|
|
62 | (3) |
|
Boolean Logic and Comparison Operators |
|
|
65 | (2) |
|
|
67 | (2) |
|
|
69 | (3) |
|
|
72 | (3) |
|
Nesting - Not Just for the Birds |
|
|
75 | (3) |
|
|
78 | (3) |
Chapter 5 Loops and Logic |
|
81 | (18) |
|
|
81 | (18) |
|
|
86 | (1) |
|
|
87 | (4) |
|
|
91 | (2) |
|
Break, Continue, and Pass Statements |
|
|
93 | (3) |
|
|
96 | (3) |
Chapter 6 Using What We've Learned |
|
99 | (22) |
|
Creating Your First Real Program |
|
|
99 | (22) |
|
|
100 | (1) |
|
|
101 | (1) |
|
|
101 | (1) |
|
Introductory Text and Accepting Input from the User |
|
|
102 | (1) |
|
|
103 | (2) |
|
Randomizing Super Hero Names |
|
|
105 | (2) |
|
|
107 | (2) |
|
Randomizing the Super Powers |
|
|
109 | (3) |
|
|
112 | (3) |
|
The superHeroGenerator3000 Code - Completed! |
|
|
115 | (6) |
Chapter 7 Saving Time with Functions, Modules, and Built-ins |
|
121 | (20) |
|
|
122 | (9) |
|
|
122 | (4) |
|
|
126 | (2) |
|
|
128 | (3) |
|
Common Built-in Functions |
|
|
131 | (6) |
|
|
131 | (6) |
|
Practice Your New Functions |
|
|
137 | (2) |
|
|
137 | (1) |
|
|
138 | (1) |
|
|
139 | (2) |
Chapter 8 Using Classes and Objects |
|
141 | (32) |
|
|
141 | (32) |
|
What Are Classes (And Will I Be Graded?) |
|
|
142 | (1) |
|
|
143 | (1) |
|
|
143 | (2) |
|
Creating Our First Object |
|
|
145 | (1) |
|
Improving the Super Hero Generator 30001 |
|
|
146 | (8) |
|
Inheritance, Subclasses, and Morel |
|
|
154 | (8) |
|
Adding the Bells and Whistles |
|
|
162 | (4) |
|
The New and Improved Super Hero Generator 3000 Code! |
|
|
166 | (5) |
|
|
171 | (2) |
Chapter 9 Introducing Other Data Structures |
|
173 | (26) |
|
|
174 | (25) |
|
|
175 | (4) |
|
|
179 | (3) |
|
|
182 | (3) |
|
|
185 | (3) |
|
Working with Dictionaries |
|
|
188 | (2) |
|
|
190 | (1) |
|
More Fun with Dictionaries |
|
|
191 | (3) |
|
|
194 | (1) |
|
|
195 | (2) |
|
|
197 | (2) |
Chapter 10 Python Files |
|
199 | (24) |
|
Working with Files in Python |
|
|
200 | (23) |
|
|
202 | (1) |
|
Creating a Text File in Python Code |
|
|
203 | (2) |
|
|
205 | (3) |
|
A Warning About Reading and Writing to Files |
|
|
208 | (1) |
|
|
209 | (2) |
|
|
211 | (6) |
|
|
217 | (1) |
|
|
218 | (2) |
|
Working With Directories.py |
|
|
220 | (1) |
|
|
221 | (2) |
Chapter 11 Python for Gaming |
|
223 | (34) |
|
|
224 | (33) |
|
Types of Games You Can Code in Python |
|
|
225 | (1) |
|
|
225 | (1) |
|
|
226 | (1) |
|
Setting Up the Pygame Bare Bones for a Game |
|
|
227 | (1) |
|
Adding to Our Game Skeleton |
|
|
228 | (3) |
|
Adding Images and Sprites in Pygame |
|
|
231 | (5) |
|
Adding Text to Our Pygame Game Window |
|
|
236 | (4) |
|
|
240 | (4) |
|
|
244 | (10) |
|
|
254 | (3) |
Chapter 12 Animating Games |
|
257 | (20) |
|
Creating Animations in Pygame |
|
|
257 | (7) |
|
Collision Detection: Bouncing off the Walls |
|
|
264 | (1) |
|
Collision Detection: Detecting the Window Boundaries |
|
|
265 | (4) |
|
|
269 | (6) |
|
|
275 | (2) |
Chapter 13 Error Handling |
|
277 | (20) |
|
|
278 | (4) |
|
|
282 | (6) |
|
|
282 | (1) |
|
|
283 | (2) |
|
|
285 | (2) |
|
The Try Except Else Block |
|
|
287 | (1) |
|
|
288 | (1) |
|
Creating Custom Exceptions |
|
|
289 | (2) |
|
|
291 | (3) |
|
Debugging Tools in Python |
|
|
294 | (1) |
|
One Final Tip for Handling Errors |
|
|
295 | (2) |
|
|
295 | (2) |
Chapter 14 Python Career |
|
297 | (20) |
|
|
299 | (1) |
|
|
299 | (5) |
|
|
300 | (1) |
|
Code Debugger/Bug Locator |
|
|
300 | (1) |
|
|
301 | (1) |
|
Software Developer/Software Engineer |
|
|
301 | (1) |
|
|
301 | (1) |
|
|
302 | (1) |
|
Web Development and Web Applications |
|
|
303 | (1) |
|
|
303 | (1) |
|
Research, Teaching, and More |
|
|
303 | (1) |
|
Common Python Interview Questions |
|
|
304 | (2) |
|
Can You Tell Me Some of the Key Features of Python? |
|
|
304 | (1) |
|
What Is the Difference Between a Tuple and a List |
|
|
305 | (1) |
|
|
305 | (1) |
|
How Do You Generate Random Values in Python? |
|
|
305 | (1) |
|
How Do You Create a List, Tuple, and Dictionary in Python |
|
|
306 | (1) |
|
What Is the Difference Between a Local Variable and a Global Variable? |
|
|
306 | (1) |
|
What Are the Different Data Types Python Offers? |
|
|
306 | (1) |
|
What Is a GUI? What Python Library Is Best for GUI Development? |
|
|
306 | (1) |
|
How Do You Open a File in Python? |
|
|
307 | (1) |
|
How Would You List the Functions of a Module? |
|
|
307 | (1) |
|
Other Python Interview Questions |
|
|
307 | (1) |
|
Best Programming Practices |
|
|
308 | (3) |
|
|
308 | (1) |
|
If It's Broken, Fix It (Now, Not Later) |
|
|
309 | (1) |
|
Documentation Is Everything |
|
|
309 | (1) |
|
Use Code Repositories and Packages |
|
|
310 | (1) |
|
|
310 | (1) |
|
Choose a Side: Indentation or Spaces |
|
|
311 | (1) |
|
Classes Are Great, But Not Everything Needs to Be One |
|
|
311 | (1) |
|
|
311 | (1) |
|
|
312 | (5) |
Index |
|
317 | |