Python Flashcards

(200 cards)

1
Q

=

A

defines variable

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

==

A

testing if two things have the same value

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

\

A

prints \

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

\t*

A

indent and an asterisk

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

\a

A

ASCII Bell (BEL)

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

\b

A

ASCII Backspace (BS)

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

\f

A

ASCII Formfeed (FF)

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

\n

A

ASCII Linefeed (LF)

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

\N{name}

A

character named name in the Unicode database (Unicode only)

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

\r ASCII

A

Carriage Return (CR)

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

\t ASCII

A

Horizontal Tab (TAB)

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

\uxxxx

A

Character with 16-bit hex value xxxx (Unicode only)

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

\Uxxxxxxxx

A

Character with 32-bit hex value xxxxxxxx (Unicode only)

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

\v

A

ASCII Vertical Tab (VT)

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

\ooo

A

Character with octal value oo

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

\xhh

A

Character with hex value hh

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

def

A

keyword, indicates a function de?nition

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

**

A

exponentiation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q
  • (strings)
A

repetition

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

value

A

One of the basic units of data, like a number or string, that a program manipulates.

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

type

A

A category of values. The types we have seen so far are integers (type int), ?oating-point numbers (type float), and strings (type str).

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

integer

A

A type that represents whole numbers.

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

floating-point

A

A type that represents numbers with fractional parts.

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

string

A

A type that represents sequences of characters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
variable
A name that refers to a value.
26
statement
A section of code that represents a command or action (assignment, print).
27
assignment
A statement that assigns a value to a variable.
28
keyword
A reserved word that is used by the compiler to parse a program; you cannot use keywords like if, def, and while as variable names.
29
operator
A special symbol that represents a simple computation like addition, multiplication, or string concatenation.
30
operand
One of the values on which an operator operates.
31
floor division
The operation that divides two numbers and chops off the fraction part.
32
expression
A combination of variables, operators, and values that represents a single result value.
33
int
converts floating-point values to integers by chopping off the fraction part
34
float
converts integers and strings to ?oating-point numbers
35
str
converts its argument to a string
36
from math import pi
imports pi from math module
37
from math import *
imports everything from math module
38
function
A named sequence of statements that performs some useful operation. Functions may or may not take arguments and may or may not produce a result.
39
function definition (def)
A statement that creates a new function, specifying its name, parameters, and the statements it executes.
40
function object
A value created by a function de?nition. The name of the function is a variable that refers to a function object.
41
header
The ?rst line of a function de?nition.
42
body
The sequence of statements inside a function de?nition.
43
parameter
A name used inside a function to refer to the value passed as an argument
44
function call
A statement that executes a function. It consists of the function name followed by an argument list.
45
argument
A value provided to a function when the function is called. This value is assigned to the corresponding parameter in the function.
46
local variable
A variable de?ned inside a function. A local variable can only be used inside its function.
47
return variable
The result of a function. If a function call is used as an expression, the return value is the value of the expression.
48
fruitful function
A function that returns a value.
49
void function
A function that doesn't return a value.
50
module
A ?le that contains a collection of related functions and other de?nitions.
51
import statement
A statement that reads a module ?le and creates a module object.
52
module object
A value created by an import statement that provides access to the values de?ned in a module.
53
dot notation
The syntax for calling a function in another module by specifying the module name followed by a dot (period) and the function name.
54
composition
Using an expression as part of a larger expression, or a statement as part of a larger statement.
55
flow of execution
The order in which statements are executed during a program run.
56
traceback
A list of the functions that are executing, printed when an exception occurs
57
state diagram
A graphical representation of a set of variables and the values they refer to.
58
stack diagram
A graphical representation of a stack of functions, their variables, and the values they refer to.
59
instance
a member of a set
60
loop
a part of a program that can execute repeatedly
61
encapsulation
The process of transforming a sequence of statements into a function de?nition.
62
generalization
The process of replacing something unnecessarily speci?c (like a number) with something appropriately general (like a variable or parameter).
63
keyword argument
An argument that includes the name of the parameter as a "keyword." (in function call)
64
interface
A description of how to use a function, including the name and descriptions of the arguments and return value.
65
refactoring
The process of modifying a working program to improve function interfaces and other qualities of the code.
66
development plan
A process for writing programs.
67
docstring
A string that appears in a function de?nition to document the function's interface.
68
precondition
A requirement that should be satis?ed by the caller before a function starts.
69
postcondition
A requirement that should be satis?ed by the function before it ends
70
x != y
x is not equal to y
71
modulus operator
An operator, denoted with a percent sign (%), that works on integers and yields the remainder when one number is divided by another.
72
boolean expression
An expression whose value is either True or False.
73
relational operator
One of the operators that compares its operands: ==, !=, >, =, <=.
74
logical operator
One of the operators that combines boolean expressions: and, or, not.
75
conditional statement
A statement that controls the ?ow of execution depending on some condition.
76
condition
The boolean expression in a conditional statement that determines which branch is executed.
77
compound statement
A statement that consists of a header and a body. The header ends with a colon (:). The body is indented relative to the header.
78
branch
One of the alternative sequences of statements in a conditional statement.
79
chained conditional
A conditional statement with a series of alternative branches.
80
nested conditional
A conditional statement that appears in one of the branches of another conditional statement.
81
recursion
The process of calling the function that is currently executing.
82
base case
A conditional branch in a recursive function that does not make a recursive call.
83
infinite recursion
A recursion that doesn't have a base case, or never reaches it. Eventually, an in?nite recursion causes a runtime error.
84
raw_input()
function which prompts user to enter something, returns strings
85
tmporary variable
A variable used to store an intermediate value in a complex calculation.
86
dead code
Part of a program that can never be executed, often because it appears after a return statement.
87
None
A special value returned by functions that have no return statement or a return statement without an argument.
88
incremental development
A program development plan intended to avoid debugging by adding and testing only a small amount of code at a time.
89
scaffolding
Code that is used during program development but is not part of the ?nal version.
90
guardian
A programming pattern that uses a conditional statement to check for and handle circumstances that might cause an error.
91
multiple asignment
Making more than one assignment to the same variable during the execution of a program.
92
update
An assignment where the new value of the variable depends on the old.
93
initialization
An assignment that gives an initial value to a variable that will be updated.
94
increment
An update that increases the value of a variable (often by one).
95
decrement
An update that decreases the value of a variable.
96
iteration
Repeated execution of a set of statements using either a recursive function call or a loop.
97
infinite loop
A loop in which the terminating condition is never satis?ed.
98
object
Something a variable can refer to. For now, you can use "object" and "value" interchangeably.
99
sequence
An ordered set; that is, a set of values where each value is identi?ed by an integer index.
100
item
One of the values in a sequence.
101
index
An integer value used to select an item in a sequence, such as a character in a string.
102
slice
A part of a string speci?ed by a range of indices.
103
empty string
A string with no characters and length 0, represented by two quotation marks.
104
immutable
The property of a sequence whose items cannot be assigned.
105
traverse
To iterate through the items in a sequence, performing a similar operation on each.
106
search
A pattern of traversal that stops when it ?nds what it is looking for.
107
counter
A variable used to count something, usually initialized to zero and then incremented.
108
method
A function that is associated with an object and called using dot notation.
109
invocation
A statement that calls a method.
110
file object
A value that represents an open ?le.
111
problem recognition
A way of solving a problem by expressing it as an instance of a previously-solved problem.
112
special case
A test case that is atypical or non-obvious (and less likely to be handled correctly).
113
=
defines variable
114
==
testing if two things have the same value
115
\\
prints \
116
\t*
indent and an asterisk
117
\a
ASCII Bell (BEL)
118
\b
ASCII Backspace (BS)
119
\f
ASCII Formfeed (FF)
120
\n
ASCII Linefeed (LF)
121
\N{name}
character named name in the Unicode database (Unicode only)
122
\r ASCII
Carriage Return (CR)
123
\t ASCII
Horizontal Tab (TAB)
124
\uxxxx
Character with 16-bit hex value xxxx (Unicode only)
125
\Uxxxxxxxx
Character with 32-bit hex value xxxxxxxx (Unicode only)
126
\v
ASCII Vertical Tab (VT)
127
\ooo
Character with octal value oo
128
\xhh
Character with hex value hh
129
def
keyword, indicates a function de?nition
130
**
exponentiation
131
* (strings)
repetition
132
value
One of the basic units of data, like a number or string, that a program manipulates.
133
type
A category of values. The types we have seen so far are integers (type int), ?oating-point numbers (type float), and strings (type str).
134
integer
A type that represents whole numbers.
135
floating-point
A type that represents numbers with fractional parts.
136
string
A type that represents sequences of characters.
137
variable
A name that refers to a value.
138
statement
A section of code that represents a command or action (assignment, print).
139
assignment
A statement that assigns a value to a variable.
140
keyword
A reserved word that is used by the compiler to parse a program; you cannot use keywords like if, def, and while as variable names.
141
operator
A special symbol that represents a simple computation like addition, multiplication, or string concatenation.
142
operand
One of the values on which an operator operates.
143
floor division
The operation that divides two numbers and chops off the fraction part.
144
expression
A combination of variables, operators, and values that represents a single result value.
145
int
converts floating-point values to integers by chopping off the fraction part
146
float
converts integers and strings to ?oating-point numbers
147
str
converts its argument to a string
148
from math import pi
imports pi from math module
149
from math import *
imports everything from math module
150
function
A named sequence of statements that performs some useful operation. Functions may or may not take arguments and may or may not produce a result.
151
function definition (def)
A statement that creates a new function, specifying its name, parameters, and the statements it executes.
152
function object
A value created by a function de?nition. The name of the function is a variable that refers to a function object.
153
header
The ?rst line of a function de?nition.
154
body
The sequence of statements inside a function de?nition.
155
parameter
A name used inside a function to refer to the value passed as an argument
156
function call
A statement that executes a function. It consists of the function name followed by an argument list.
157
argument
A value provided to a function when the function is called. This value is assigned to the corresponding parameter in the function.
158
local variable
A variable de?ned inside a function. A local variable can only be used inside its function.
159
return variable
The result of a function. If a function call is used as an expression, the return value is the value of the expression.
160
fruitful function
A function that returns a value.
161
void function
A function that doesn't return a value.
162
module
A ?le that contains a collection of related functions and other de?nitions.
163
import statement
A statement that reads a module ?le and creates a module object.
164
module object
A value created by an import statement that provides access to the values de?ned in a module.
165
dot notation
The syntax for calling a function in another module by specifying the module name followed by a dot (period) and the function name.
166
composition
Using an expression as part of a larger expression, or a statement as part of a larger statement.
167
flow of execution
The order in which statements are executed during a program run.
168
traceback
A list of the functions that are executing, printed when an exception occurs
169
state diagram
A graphical representation of a set of variables and the values they refer to.
170
stack diagram
A graphical representation of a stack of functions, their variables, and the values they refer to.
171
instance
a member of a set
172
loop
a part of a program that can execute repeatedly
173
encapsulation
The process of transforming a sequence of statements into a function de?nition.
174
generalization
The process of replacing something unnecessarily speci?c (like a number) with something appropriately general (like a variable or parameter).
175
keyword argument
An argument that includes the name of the parameter as a "keyword." (in function call)
176
interface
A description of how to use a function, including the name and descriptions of the arguments and return value.
177
refactoring
The process of modifying a working program to improve function interfaces and other qualities of the code.
178
development plan
A process for writing programs.
179
docstring
A string that appears in a function de?nition to document the function's interface.
180
precondition
A requirement that should be satis?ed by the caller before a function starts.
181
postcondition
A requirement that should be satis?ed by the function before it ends
182
x != y
x is not equal to y
183
modulus operator
An operator, denoted with a percent sign (%), that works on integers and yields the remainder when one number is divided by another.
184
boolean expression
An expression whose value is either True or False.
185
relational operator
One of the operators that compares its operands: ==, !=, >, =, <=.
186
logical operator
One of the operators that combines boolean expressions: and, or, not.
187
conditional statement
A statement that controls the ?ow of execution depending on some condition.
188
condition
The boolean expression in a conditional statement that determines which branch is executed.
189
compound statement
A statement that consists of a header and a body. The header ends with a colon (:). The body is indented relative to the header.
190
branch
One of the alternative sequences of statements in a conditional statement.
191
chained conditional
A conditional statement with a series of alternative branches.
192
nested conditional
A conditional statement that appears in one of the branches of another conditional statement.
193
recursion
The process of calling the function that is currently executing.
194
base case
A conditional branch in a recursive function that does not make a recursive call.
195
infinite recursion
A recursion that doesn't have a base case, or never reaches it. Eventually, an in?nite recursion causes a runtime error.
196
raw_input()
function which prompts user to enter something, returns strings
197
tmporary variable
A variable used to store an intermediate value in a complex calculation.
198
dead code
Part of a program that can never be executed, often because it appears after a return statement.
199
None
A special value returned by functions that have no return statement or a return statement without an argument.
200
incremental development
A program development plan intended to avoid debugging by adding and testing only a small amount of code at a time.