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
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

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.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
52
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
53
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
54
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
55
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
56
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
57
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
58
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
59
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
60
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
61
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
62
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
63
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
64
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
65
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
66
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
67
Q

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.

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

An important detail about the range function is that if we don’t provide a start point, it automatically starts from zero

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
70
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
71
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
72
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
73
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
74
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
75
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
76
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
77
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
78
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
79
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
80
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
81
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
82
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
83
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
84
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
85
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
86
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
87
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
88
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
89
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
90
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
91
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
92
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
93
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
94
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
95
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
96
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
97
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
98
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
99
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
100
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
101
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
102
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
103
Q

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

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

A __________ is a section of code that can be reused in a program.

A

function

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

Built-in functions are functions that exist within Python and can be called directly. They are available to us by default.

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

User-defined functions are functions that programmers design for their specific needs.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
107
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
108
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
109
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
110
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
111
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
112
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
113
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
114
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
115
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
116
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
117
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
118
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
119
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
120
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
120
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
121
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
121
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
122
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
123
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
124
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
125
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
126
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
127
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
128
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
129
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
130
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
131
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
132
Q
A
133
Q
A
134
Q
A
135
Q
A
136
Q
A
137
Q
A
138
Q
A
139
Q
A
140
Q
A
140
Q
A
141
Q
A
142
Q
A
143
Q
A
144
Q
A
145
Q
A
145
Q
A
146
Q
A
147
Q
A
148
Q
A
149
Q
A
150
Q
A
151
Q

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.

A
152
Q
A
153
Q
A
154
Q
A
155
Q
A
156
Q
A
157
Q
A
158
Q
A
159
Q

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

A
160
Q
A
161
Q
A
162
Q
A
163
Q
A
164
Q
A
165
Q
A
166
Q
A
167
Q
A
168
Q
A
169
Q
A
170
Q
A
171
Q
A
172
Q
A
173
Q
A
174
Q
A
175
Q
A
176
Q
A
177
Q
A
178
Q
A
179
Q
A
180
Q
A
181
Q
A
182
Q
A
183
Q
A
184
Q
A
185
Q
A
186
Q
A
187
Q
A
188
Q
A
189
Q
A
190
Q
A
191
Q
A
192
Q
A
193
Q
A
194
Q
A
195
Q
A
196
Q
A
197
Q
A
198
Q
A
199
Q
A
200
Q
A
201
Q
A
202
Q
A
203
Q
A
204
Q
A
205
Q
A
206
Q
A
207
Q
A
208
Q
A
209
Q
A
210
Q
A
211
Q
A
212
Q
A
213
Q
A
214
Q
A
215
Q
A
216
Q
A
217
Q
A
218
Q
A
219
Q
A
220
Q
A
221
Q
A
222
Q

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”.

A
223
Q
A
224
Q
A
225
Q
A
226
Q
A
227
Q
A
228
Q
A
229
Q
A
230
Q
A
231
Q
A
232
Q
A
233
Q
A
234
Q
A
235
Q
A
236
Q
A
237
Q
A
238
Q
A
239
Q
A
240
Q
A
241
Q
A
242
Q
A
243
Q
A
244
Q
A
245
Q
A
246
Q
A
247
Q

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

A
248
Q
A
249
Q
A
250
Q
A
251
Q
A
252
Q
A
253
Q
A
254
Q
A
255
Q
A
256
Q
A
257
Q
A
258
Q
A
259
Q
A
260
Q
A
261
Q
A
262
Q
A
263
Q
A
264
Q
A
265
Q
A
266
Q
A
267
Q
A
268
Q
A
269
Q
A
270
Q
A
271
Q
A
272
Q
A
273
Q
A
273
Q
A
273
Q
A
273
Q
A
274
Q
A
274
Q
A
274
Q
A
274
Q
A
274
Q
A
275
Q
A
275
Q
A
276
Q
A
276
Q
A
277
Q
A
278
Q
A
278
Q
A
279
Q
A
279
Q
A
280
Q
A
281
Q
A
281
Q
A
282
Q
A
283
Q
A
284
Q
A
285
Q
A
285
Q
A
286
Q
A
287
Q
A
288
Q
A
288
Q
A
288
Q
A
288
Q
A
288
Q
A
288
Q
A
288
Q
A
289
Q
A
289
Q
A
289
Q
A
289
Q
A
289
Q
A
289
Q
A
289
Q
A
290
Q
A
291
Q
A
291
Q
A
291
Q
A
292
Q
A
292
Q
A
292
Q
A
292
Q

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

A
293
Q
A
294
Q
A
295
Q
A
295
Q
A
295
Q
A
296
Q
A
297
Q
A
298
Q
A