Course 7 - Python Flashcards

1
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

is how you make a comment in Python

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Python uses several data types. We’ll focus on string, float, integer, Boolean, and list data.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

String data is data consisting of an ordered sequence of characters. These characters could be letters, symbols, spaces, and even numbers. Numbers in the string data type cannot be used for calculations. All characters in a string must be placed inside quotation marks. Luckily, Python will tell you by giving you an error message if you forget a quotation mark.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Float data is data consisting of a number with a decimal point. This includes fractions like 2.1 or 10.5. It also includes whole numbers with a decimal point like 2.0 or 10.0.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Integer data is data consisting of a number that does not include a decimal point. Numbers such as 0, -9, and 5,000 are valid integers.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

We can use print with float and integer data to perform all kinds of mathematical operations like addition, subtraction, multiplication, and division.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Boolean data is data that can only be one of two values: either True or False. Booleans are useful for logic in our programs.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

And the last data type we’ll cover is lists. List data is a data structure that consists of a collection of data in sequential form.

We need to place the list in brackets. After this, we place the individual items in the list in quotation marks and separate them with commas.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

A variable is a container that stores data.

To create a variable, you need a name for it. Then, you add an equals sign and then an object to store in it. Creating a variable is often called assignment. The best practice for naming variables is to make the names relevant to what they’re being used for.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

But if we could use the string directly, why do we need variables? Well, we often use variables to simplify our code or make it cleaner and easier to read. Or if we needed a very long string or number, storing it in a variable would let us use it throughout our code without typing it all out. In the previous example, the variable stored string data, but variables can store a variety of data types. Variables have the data type of the object currently storing them.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

A type error is an error that results from using the wrong data type.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
26
Earlier, we mentioned how variables are like containers. What they hold can change. After we define a variable, we can always change the object inside of it. This is called reassignment. Reassigning a variable is very similar to assigning it in the first place.
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
The loop variable is a variable that is used to control the iterations of a loop. The loop variable comes directly after for. A common name for it is the letter i, but you can give it any other name you want.
68
69
An important detail about the range function is that if we don't provide a start point, it automatically starts from zero
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
Automation: The use of technology to reduce human and manual effort to perform common and repetitive tasks Boolean data: Data that can only be one of two values: either True or False Command-line interface: A text-based user interface that uses commands to interact with the computer Comment: A note programmers make about the intention behind their code Conditional statement: A statement that evaluates code to determine if it meets a specified set of conditions Data type: A category for a particular type of data item Dictionary data: Data that consists of one or more key-value pairs Float data: Data consisting of a number with a decimal point Integer data: Data consisting of a number that does not include a decimal point Integrated development environment (IDE): A software application for writing code that provides editing assistance and error correction tools Interpreter: A computer program that translates Python code into runnable instructions line by line Iterative statement: Code that repeatedly executes a set of instructions List data: Data structure that consists of a collection of data in sequential form Loop variable: A variable that is used to control the iterations of a loop Notebook: An online interface for writing, storing, and running code Programming: A process that can be used to create a specific set of instructions for a computer to execute tasks Set data: Data that consists of an unordered collection of unique values String data: Data consisting of an ordered sequence of characters Syntax: The rules that determine what is correctly structured in a computing language Tuple data: Data structure that consists of a collection of data that cannot be changed Type error: An error that results from using the wrong data type Variable: A container that stores data
104
A __________ is a section of code that can be reused in a program.
function
105
Built-in functions are functions that exist within Python and can be called directly. They are available to us by default.
106
User-defined functions are functions that programmers design for their specific needs.
107
108
109
110
111
112
113
114
115
116
117
118
119
120
120
121
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
140
141
142
143
144
145
145
146
147
148
149
150
151
In addition to what's always available through the Python Standard Library, you can also download external libraries. A couple of examples are Beautiful Soup for parsing HTML website files and NumPy for arrays and mathematical computations. These libraries will assist you as a security analyst in network traffic analysis, log file parsing, and complex math.
152
153
154
155
156
157
158
159
Argument (Python): The data brought into a function when it is called Built-in function: A function that exists within Python and can be called directly Comment: A note programmers make about the intention behind their code Function: A section of code that can be reused in a program Global variable: A variable that is available through the entire program Indentation: Space added at the beginning of a line of code Library: A collection of modules that provide code users can access in their programs Local variable: A variable assigned within a function Module: A Python file that contains additional functions, variables, classes, and any kind of runnable code Parameter (Python): An object that is included in a function definition for use in that function PEP 8 style guide: A resource that provides stylistic guidelines for programmers working in Python Python Standard Library: An extensive collection of Python code that often comes packaged with Python Return statement: A Python statement that executes inside a function and sends information back to the function call Style guide: A manual that informs the writing, formatting, and design of documents User-defined function: A function that programmers design for their specific needs
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
Let's start with this string of device IDs. These are all the instances of the letter "a" written once or multiple times in a row. The first instance has one "a", the second has two "a's", the third one has one "a", and the fourth has three "a's". So, if we told Python to find matches to the a+ sign regular expression, it would return this list of "a's".
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
Algorithm: A set of rules that solve a problem Bracket notation: The indices placed in square brackets Debugging: The practice of identifying and fixing errors in code Immutable: An object that cannot be changed after it is created and assigned a value Index: A number assigned to every element in a sequence that indicates its position List concatenation: The concept of combining two lists into one by placing the elements of the second list directly after the elements of the first list List data: Data structure that consists of a collection of data in sequential form Method: A function that belongs to a specific data type Regular expression (regex): A sequence of characters that forms a pattern String concatenation: The process of joining two strings together String data: Data consisting of an ordered sequence of characters Substring: A continuous sequence of characters within a string
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
273
273
273
274
274
274
274
274
275
275
276
276
277
278
278
279
279
280
281
281
282
283
284
285
285
286
287
288
288
288
288
288
288
288
289
289
289
289
289
289
289
290
291
291
291
292
292
292
292
Automation: The use of technology to reduce human and manual effort to perform common and repetitive tasks Conditional statement: A statement that evaluates code to determine if it meets a specified set of conditions Debugger: A software tool that helps to locate the source of an error and assess its causes Debugging: The practice of identifying and fixing errors in code Exception: An error that involves code that cannot be executed even though it is syntactically correct File path: The location of a file or directory Function: A section of code that can be reused in a program Integrated development environment (IDE): A software application for writing code that provides editing assistance and error correction tools Iterative statement: Code that repeatedly executes a set of instructions Log: A record of events that occur within an organization's systems Logic error: An error that results when the logic used in code produces unintended results Parsing: The process of converting data into a more readable format Syntax error: An error that involves invalid usage of a programming language Variable: A container that stores data
293
294
295
295
295
296
297
298