Author(s): Mark Myers
Edition: First Edition
Publisher: CreateSpace IPP
Year: 2017
Language: English
Pages: 234
Title Page......Page 4
Copyright......Page 5
Table of Contents......Page 6
Learn it faster. Remember it longer.......Page 9
How to use this book......Page 11
The language you're learning here......Page 13
1: print......Page 14
2: Variables for Strings......Page 15
3: Variables for Numbers......Page 20
4: Math expressions: Familiar operators......Page 23
5: Variable Names Legal and Illegal......Page 25
6: Math expressions: Unfamiliar operators......Page 27
7: Math expressions: Eliminating ambiguity......Page 29
8: Concatenating text strings......Page 31
9: if statements......Page 34
10: Comparison operators......Page 37
11: else and elif statements......Page 39
12: Testing sets of conditions......Page 42
13: if statements nested......Page 45
14: Comments......Page 49
15: Lists......Page 52
16: Lists: Adding and changing elements......Page 55
17: Lists: Taking slices out of them......Page 59
18: Lists: Deleting and removing elements......Page 61
19: Lists: popping elements......Page 64
20: Tuples......Page 67
21: for loops......Page 69
22: for loops nested......Page 73
23: Getting information from the user and converting strings and numbers......Page 75
24: Changing case......Page 78
25: Dictionaries: What they are......Page 81
26: Dictionaries: How to code one......Page 83
27: Dictionaries: How to pick information out of them......Page 85
28: Dictionaries: The versatility of keys and values......Page 87
29: Dictionaries: Adding items......Page 90
30: Dictionaries: Removing and changing items......Page 92
31: Dictionaries: Looping through values......Page 94
32: Dictionaries: Looping through keys......Page 97
33: Dictionaries: Looping through key-value pairs......Page 99
34: Creating a list of dictionaries......Page 101
35: How to pick information out of a list of dictionaries......Page 103
36: How to append a new dictionary to a list of dictionaries......Page 107
37: Creating a dictionary that contains lists......Page 109
38: How to get information out of a list within a dictionary......Page 111
39: Creating a dictionary that contains a dictionary......Page 114
40: How to get information out of a dictionary within another dictionary......Page 119
41: Functions......Page 121
42: Functions: Passing them information......Page 124
43: Functions: Passing information to them a different way......Page 128
44: Functions: Assigning a default value to a parameter......Page 130
45: Functions: Mixing positional and keyword arguments......Page 133
46: Functions: Dealing with an unknown number of arguments......Page 137
47: Functions: Passing information back from them......Page 140
48: Using functions as variables (which is what they really are)......Page 143
49: Functions: Local vs. global variables......Page 145
50: Functions within functions......Page 149
51: While loops......Page 151
52: While loops: Setting a flag......Page 155
53: Classes......Page 157
54: Classes: Starting to build the structure......Page 159
55: Classes: A bit of housekeeping......Page 161
56: Classes: Creating an instance......Page 163
57: Classes: A little more complexity......Page 167
58: Classes: Getting info out of instances......Page 170
59: Classes: Building functions into them......Page 172
60: Classes: Coding a method......Page 174
61: Classes: Changing an attribute's value......Page 177
62: Data files......Page 180
63: Data files: Storing data......Page 183
64: Data files: Retrieving data......Page 185
65: Data files: Appending data......Page 187
66: Modules......Page 189
67: CSV files......Page 191
68: CSV files: Reading them......Page 193
69: CSV files: Picking information out of them......Page 195
70: CSV files: Loading information into them. Part 1......Page 200
71: CSV files: Loading information into them. Part 2......Page 203
72: CSV files: Loading information into them. Part 3......Page 206
73: CSV files: Appending rows to them.......Page 209
74: How to save a Python list or dictionary in a file: JSON......Page 211
75: How to retrieve a Python list or dictionary from a JSON file......Page 215
76: Planning for things to go wrong......Page 217
77: A more practical example of exception handling......Page 220
Guide to the appendices......Page 222
Appendix A: An easy way to run Python......Page 223
Appendix B: How to install Python on your computer......Page 224
Appendix C: How to run Python in the terminal......Page 226
Appendix D: How to create a Python program that you can save......Page 230
Appendix E: How to run a saved Python program in the terminal......Page 233