Python Flashcards

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
Q

variable

A

A name that refers to a value.

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

statement

A

A section of code that represents a command or action (assignment, print).

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

assignment

A

A statement that assigns a value to a variable.

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

keyword

A

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.

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

operator

A

A special symbol that represents a simple computation like addition, multiplication, or string concatenation.

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

operand

A

One of the values on which an operator operates.

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

floor division

A

The operation that divides two numbers and chops off the fraction part.

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

expression

A

A combination of variables, operators, and values that represents a single result value.

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

int

A

converts floating-point values to integers by chopping off the fraction part

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

float

A

converts integers and strings to ?oating-point numbers

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

str

A

converts its argument to a string

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

from math import pi

A

imports pi from math module

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

from math import *

A

imports everything from math module

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

function

A

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.

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

function definition (def)

A

A statement that creates a new function, specifying its name, parameters, and the statements it executes.

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

function object

A

A value created by a function de?nition. The name of the function is a variable that refers to a function object.

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

header

A

The ?rst line of a function de?nition.

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

body

A

The sequence of statements inside a function de?nition.

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

parameter

A

A name used inside a function to refer to the value passed as an argument

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

function call

A

A statement that executes a function. It consists of the function name followed by an argument list.

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

argument

A

A value provided to a function when the function is called. This value is assigned to the corresponding parameter in the function.

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

local variable

A

A variable de?ned inside a function. A local variable can only be used inside its function.

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

return variable

A

The result of a function. If a function call is used as an expression, the return value is the value of the expression.

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

fruitful function

A

A function that returns a value.

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

void function

A

A function that doesn’t return a value.

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

module

A

A ?le that contains a collection of related functions and other de?nitions.

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

import statement

A

A statement that reads a module ?le and creates a module object.

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

module object

A

A value created by an import statement that provides access to the values de?ned in a module.

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

dot notation

A

The syntax for calling a function in another module by specifying the module name followed by a dot (period) and the function name.

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

composition

A

Using an expression as part of a larger expression, or a statement as part of a larger statement.

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

flow of execution

A

The order in which statements are executed during a program run.

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

traceback

A

A list of the functions that are executing, printed when an exception occurs

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

state diagram

A

A graphical representation of a set of variables and the values they refer to.

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

stack diagram

A

A graphical representation of a stack of functions, their variables, and the values they refer to.

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

instance

A

a member of a set

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

loop

A

a part of a program that can execute repeatedly

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

encapsulation

A

The process of transforming a sequence of statements into a function de?nition.

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

generalization

A

The process of replacing something unnecessarily speci?c (like a number) with something appropriately general (like a variable or parameter).

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

keyword argument

A

An argument that includes the name of the parameter as a “keyword.” (in function call)

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

interface

A

A description of how to use a function, including the name and descriptions of the arguments and return value.

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

refactoring

A

The process of modifying a working program to improve function interfaces and other qualities of the code.

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

development plan

A

A process for writing programs.

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

docstring

A

A string that appears in a function de?nition to document the function’s interface.

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

precondition

A

A requirement that should be satis?ed by the caller before a function starts.

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

postcondition

A

A requirement that should be satis?ed by the function before it ends

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

x != y

A

x is not equal to y

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

modulus operator

A

An operator, denoted with a percent sign (%), that works on integers and yields the remainder when one number is divided by another.

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

boolean expression

A

An expression whose value is either True or False.

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

relational operator

A

One of the operators that compares its operands: ==, !=, >, =, <=.

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

logical operator

A

One of the operators that combines boolean expressions: and, or, not.

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

conditional statement

A

A statement that controls the ?ow of execution depending on some condition.

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

condition

A

The boolean expression in a conditional statement that determines which branch is executed.

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

compound statement

A

A statement that consists of a header and a body. The header ends with a colon (:). The body is indented relative to the header.

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

branch

A

One of the alternative sequences of statements in a conditional statement.

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

chained conditional

A

A conditional statement with a series of alternative branches.

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

nested conditional

A

A conditional statement that appears in one of the branches of another conditional statement.

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

recursion

A

The process of calling the function that is currently executing.

82
Q

base case

A

A conditional branch in a recursive function that does not make a recursive call.

83
Q

infinite recursion

A

A recursion that doesn’t have a base case, or never reaches it. Eventually, an in?nite recursion causes a runtime error.

84
Q

raw_input()

A

function which prompts user to enter something, returns strings

85
Q

tmporary variable

A

A variable used to store an intermediate value in a complex calculation.

86
Q

dead code

A

Part of a program that can never be executed, often because it appears after a return statement.

87
Q

None

A

A special value returned by functions that have no return statement or a return statement without an argument.

88
Q

incremental development

A

A program development plan intended to avoid debugging by adding and testing only a small amount of code at a time.

89
Q

scaffolding

A

Code that is used during program development but is not part of the ?nal version.

90
Q

guardian

A

A programming pattern that uses a conditional statement to check for and handle circumstances that might cause an error.

91
Q

multiple asignment

A

Making more than one assignment to the same variable during the execution of a program.

92
Q

update

A

An assignment where the new value of the variable depends on the old.

93
Q

initialization

A

An assignment that gives an initial value to a variable that will be updated.

94
Q

increment

A

An update that increases the value of a variable (often by one).

95
Q

decrement

A

An update that decreases the value of a variable.

96
Q

iteration

A

Repeated execution of a set of statements using either a recursive function call or a loop.

97
Q

infinite loop

A

A loop in which the terminating condition is never satis?ed.

98
Q

object

A

Something a variable can refer to. For now, you can use “object” and “value” interchangeably.

99
Q

sequence

A

An ordered set; that is, a set of values where each value is identi?ed by an integer index.

100
Q

item

A

One of the values in a sequence.

101
Q

index

A

An integer value used to select an item in a sequence, such as a character in a string.

102
Q

slice

A

A part of a string speci?ed by a range of indices.

103
Q

empty string

A

A string with no characters and length 0, represented by two quotation marks.

104
Q

immutable

A

The property of a sequence whose items cannot be assigned.

105
Q

traverse

A

To iterate through the items in a sequence, performing a similar operation on each.

106
Q

search

A

A pattern of traversal that stops when it ?nds what it is looking for.

107
Q

counter

A

A variable used to count something, usually initialized to zero and then incremented.

108
Q

method

A

A function that is associated with an object and called using dot notation.

109
Q

invocation

A

A statement that calls a method.

110
Q

file object

A

A value that represents an open ?le.

111
Q

problem recognition

A

A way of solving a problem by expressing it as an instance of a previously-solved problem.

112
Q

special case

A

A test case that is atypical or non-obvious (and less likely to be handled correctly).

113
Q

=

A

defines variable

114
Q

==

A

testing if two things have the same value

115
Q

\

A

prints \

116
Q

\t*

A

indent and an asterisk

117
Q

\a

A

ASCII Bell (BEL)

118
Q

\b

A

ASCII Backspace (BS)

119
Q

\f

A

ASCII Formfeed (FF)

120
Q

\n

A

ASCII Linefeed (LF)

121
Q

\N{name}

A

character named name in the Unicode database (Unicode only)

122
Q

\r ASCII

A

Carriage Return (CR)

123
Q

\t ASCII

A

Horizontal Tab (TAB)

124
Q

\uxxxx

A

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

125
Q

\Uxxxxxxxx

A

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

126
Q

\v

A

ASCII Vertical Tab (VT)

127
Q

\ooo

A

Character with octal value oo

128
Q

\xhh

A

Character with hex value hh

129
Q

def

A

keyword, indicates a function de?nition

130
Q

**

A

exponentiation

131
Q
  • (strings)
A

repetition

132
Q

value

A

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

133
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).

134
Q

integer

A

A type that represents whole numbers.

135
Q

floating-point

A

A type that represents numbers with fractional parts.

136
Q

string

A

A type that represents sequences of characters.

137
Q

variable

A

A name that refers to a value.

138
Q

statement

A

A section of code that represents a command or action (assignment, print).

139
Q

assignment

A

A statement that assigns a value to a variable.

140
Q

keyword

A

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
Q

operator

A

A special symbol that represents a simple computation like addition, multiplication, or string concatenation.

142
Q

operand

A

One of the values on which an operator operates.

143
Q

floor division

A

The operation that divides two numbers and chops off the fraction part.

144
Q

expression

A

A combination of variables, operators, and values that represents a single result value.

145
Q

int

A

converts floating-point values to integers by chopping off the fraction part

146
Q

float

A

converts integers and strings to ?oating-point numbers

147
Q

str

A

converts its argument to a string

148
Q

from math import pi

A

imports pi from math module

149
Q

from math import *

A

imports everything from math module

150
Q

function

A

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
Q

function definition (def)

A

A statement that creates a new function, specifying its name, parameters, and the statements it executes.

152
Q

function object

A

A value created by a function de?nition. The name of the function is a variable that refers to a function object.

153
Q

header

A

The ?rst line of a function de?nition.

154
Q

body

A

The sequence of statements inside a function de?nition.

155
Q

parameter

A

A name used inside a function to refer to the value passed as an argument

156
Q

function call

A

A statement that executes a function. It consists of the function name followed by an argument list.

157
Q

argument

A

A value provided to a function when the function is called. This value is assigned to the corresponding parameter in the function.

158
Q

local variable

A

A variable de?ned inside a function. A local variable can only be used inside its function.

159
Q

return variable

A

The result of a function. If a function call is used as an expression, the return value is the value of the expression.

160
Q

fruitful function

A

A function that returns a value.

161
Q

void function

A

A function that doesn’t return a value.

162
Q

module

A

A ?le that contains a collection of related functions and other de?nitions.

163
Q

import statement

A

A statement that reads a module ?le and creates a module object.

164
Q

module object

A

A value created by an import statement that provides access to the values de?ned in a module.

165
Q

dot notation

A

The syntax for calling a function in another module by specifying the module name followed by a dot (period) and the function name.

166
Q

composition

A

Using an expression as part of a larger expression, or a statement as part of a larger statement.

167
Q

flow of execution

A

The order in which statements are executed during a program run.

168
Q

traceback

A

A list of the functions that are executing, printed when an exception occurs

169
Q

state diagram

A

A graphical representation of a set of variables and the values they refer to.

170
Q

stack diagram

A

A graphical representation of a stack of functions, their variables, and the values they refer to.

171
Q

instance

A

a member of a set

172
Q

loop

A

a part of a program that can execute repeatedly

173
Q

encapsulation

A

The process of transforming a sequence of statements into a function de?nition.

174
Q

generalization

A

The process of replacing something unnecessarily speci?c (like a number) with something appropriately general (like a variable or parameter).

175
Q

keyword argument

A

An argument that includes the name of the parameter as a “keyword.” (in function call)

176
Q

interface

A

A description of how to use a function, including the name and descriptions of the arguments and return value.

177
Q

refactoring

A

The process of modifying a working program to improve function interfaces and other qualities of the code.

178
Q

development plan

A

A process for writing programs.

179
Q

docstring

A

A string that appears in a function de?nition to document the function’s interface.

180
Q

precondition

A

A requirement that should be satis?ed by the caller before a function starts.

181
Q

postcondition

A

A requirement that should be satis?ed by the function before it ends

182
Q

x != y

A

x is not equal to y

183
Q

modulus operator

A

An operator, denoted with a percent sign (%), that works on integers and yields the remainder when one number is divided by another.

184
Q

boolean expression

A

An expression whose value is either True or False.

185
Q

relational operator

A

One of the operators that compares its operands: ==, !=, >, =, <=.

186
Q

logical operator

A

One of the operators that combines boolean expressions: and, or, not.

187
Q

conditional statement

A

A statement that controls the ?ow of execution depending on some condition.

188
Q

condition

A

The boolean expression in a conditional statement that determines which branch is executed.

189
Q

compound statement

A

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
Q

branch

A

One of the alternative sequences of statements in a conditional statement.

191
Q

chained conditional

A

A conditional statement with a series of alternative branches.

192
Q

nested conditional

A

A conditional statement that appears in one of the branches of another conditional statement.

193
Q

recursion

A

The process of calling the function that is currently executing.

194
Q

base case

A

A conditional branch in a recursive function that does not make a recursive call.

195
Q

infinite recursion

A

A recursion that doesn’t have a base case, or never reaches it. Eventually, an in?nite recursion causes a runtime error.

196
Q

raw_input()

A

function which prompts user to enter something, returns strings

197
Q

tmporary variable

A

A variable used to store an intermediate value in a complex calculation.

198
Q

dead code

A

Part of a program that can never be executed, often because it appears after a return statement.

199
Q

None

A

A special value returned by functions that have no return statement or a return statement without an argument.

200
Q

incremental development

A

A program development plan intended to avoid debugging by adding and testing only a small amount of code at a time.