Python Fundamentals Flashcards

1
Q

activecode

A

A unique interpreter environment that allows Python to be executed from within a web browser.

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

algorithm

A

A general step by step process for solving a problem.

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

bug

A

An error in a program.

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

byte code

A

An intermediate language between source code and object code. Many modern languages first compile source code into byte code and then interpret the byte code with a program called a virtual machine.

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

codelens

A

An interactive environment that allows the user to control the step by step execution of a Python program

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

comment

A

Information in a program that is meant for other programmers (or anyone reading the source code) and has no effect on the execution of the program.

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

compile

A

To translate a program written in a high-level language into a low-level language all at once, in preparation for later execution.

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

debugging

A

The process of finding and removing any of the three kinds of programming errors.

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

exception

A

Another name for a runtime error.

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

executable

A

Another name for object code that is ready to be executed.

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

formal language

A

Any one of the languages that people have designed for specific purposes, such as representing mathematical ideas or computer programs; all programming languages are formal languages.

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

high-level language

A

A programming language like Python that is designed to be easy for humans to read and write.

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

interpret

A

To execute a program in a high-level language by translating it one line at a time.

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

low-level language

A

A programming language that is designed to be easy for a computer to execute; also called machine language or assembly language.

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

natural language

A

Any one of the languages that people speak that evolved naturally.

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

object code

A

The output of the compiler after it translates the program.

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

parse

A

To examine a program and analyze the syntactic structure.

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

portability

A

A property of a program that can run on more than one kind of computer.

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

print function

A

A function used in a program or script that causes the Python interpreter to display a value on its output device.

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

problem solving

A

The process of formulating a problem, finding a solution, and expressing the solution.

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

program

A

A sequence of instructions that specifies to a computer actions and computations to be performed.

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

programming language

A

A formal notation for representing solutions.

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

Python shell

A

An interactive user interface to the Python interpreter. The user of a Python shell types commands at the prompt (»>), and presses the return key to send these commands immediately to the interpreter for processing.

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

runtime error

A

An error that does not occur until the program has started to execute but that prevents the program from continuing.

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

semantic error

A

An error in a program that makes it do something other than what the programmer intended.

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

semantics

A

The meaning of a program.

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

shell mode

A

A style of using Python where we type expressions at the command prompt, and the results are shown immediately. Contrast with source code, and see the entry under Python shell.

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

source code

A

A program, stored in a file, in a high-level language before being compiled or interpreted.

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

syntax

A

The structure of a program.

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

syntax error

A

An error in a program that makes it impossible to parse — and therefore impossible to interpret.

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

token

A

One of the basic elements of the syntactic structure of a program, analogous to a word in a natural language.

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

assignment statement

A

A statement that assigns a value to a name (variable). To the left of the assignment operator, =, is a name. To the right of the assignment token is an expression which is evaluated by the Python interpreter and then assigned to the name. The difference between the left and right hand sides of the assignment statement is often confusing to new programmers. In the following assignment:

n = n + 1

n plays a very different role on each side of the =. On the right it is a value and makes up part of the expression which will be evaluated by the Python interpreter before assigning it to the name on the left.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

assignment token

A

assignment token
= is Python’s assignment token, which should not be confused with the mathematical comparison operator using the same symbol.

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

comment

A

Information in a program that is meant for other programmers (or anyone reading the source code) and has no effect on the execution of the program.

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

data type or class

A

A set of values. The type of a value determines how it can be used in expressions. So far, the types you have seen are integers (int), floating-point numbers (float), and strings (str).

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

decrement

A

Decrease by 1.

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

evaluate

A

To simplify an expression by performing the operations in order to yield a single value.

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

expression

A

A combination of operators and operands (variables and values) that represents a single result value. Expressions are evaluated to give that result.

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

float

A

A Python data type which stores floating-point numbers. Floating-point numbers are stored internally in two parts: a base and an exponent. When printed in the standard format, they look like decimal numbers. Beware of rounding errors when you use floats, and remember that they are only approximate values.

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

increment

A

Both as a noun and as a verb, increment means to increase by 1.

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

initialization (of a variable)

A

To initialize a variable is to give it an initial value. Since in Python variables don’t exist until they are assigned values, they are initialized when they are created. In other programming languages this is not the case, and variables can be created without being initialized, in which case they have either default or garbage values.

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

int

A

A Python data type that holds positive and negative whole numbers.

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

integer division

A

An operation that divides one integer by another and yields an integer. Integer division yields only the whole number of times that the numerator is divisible by the denominator and discards any remainder.

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

keyword

A

A reserved word that is used by the compiler to parse 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
45
Q

modulus operator

A

Also called remainder operator or integer remainder operator. Gives the remainder after performing integer division.

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

object

A

Also known as a data object (or data value). The fundamental things that programs are designed to manipulate (or that programmers ask to do things for them).

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

prompt string

A

Used during interactive input to provide the use with hints as to what type of value to enter.

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

reference diagram

A

A picture showing a variable with an arrow pointing to the value (object) that the variable refers to. See also state snapshot.

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

rules of precedence

A

The set of rules governing the order in which expressions involving multiple operators and operands are evaluated.

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

state snapshot

A

A graphical representation of a set of variables and the values to which they refer, taken at a particular instant during the program’s execution.

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

statement

A

An instruction that the Python interpreter can execute. So far we have only seen the assignment statement, but we will soon meet the import statement and the for statement.

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

str

A

A Python data type that holds a string of characters.

55
Q

type conversion function

A

A function that can convert a data value from one type to another.

56
Q

value

A

A number or string (or other things to be named later) that can be stored in a variable or computed in an expression.

57
Q

variable

A

A name that refers to a value.

58
Q

variable name

A

A name given to a variable. Variable names in Python consist of a sequence of letters (a..z, A..Z, and _) and digits (0..9) that begins with a letter. In best programming practice, variable names should be chosen so that they describe their use in the program, making the program self documenting.

59
Q

attribute

A

Some state or value that belongs to a particular object. For example, tess has a color.

60
Q

canvas

A

A surface within a window where drawing takes place.

61
Q

control flow

A

See flow of execution in the next chapter.

62
Q

for loop

A

A statement in Python for convenient repetition of statements in the body of the loop.

63
Q

instance

A

An object that belongs to a class. tess and alex are different instances of the class Turtle

64
Q

invoke

A

An object has methods. We use the verb invoke to mean activate the method. Invoking a method is done by putting parentheses after the method name, with some possible arguments. So wn.exitonclick() is an invocation of the exitonclick method.

65
Q

iteration

A

A basic building block for algorithms (programs). It allows steps to be repeated. Sometimes called looping.

66
Q

loop body

A

Any number of statements nested inside a loop. The nesting is indicated by the fact that the statements are indented under the for loop statement.

67
Q

loop variable

A

A variable used as part of a for loop. It is assigned a different value on each iteration of the loop, and is used as part of the terminating condition of the loop,

68
Q

method

A

A function that is attached to an object. Invoking or activating the method causes the object to respond in some way, e.g. forward is the method when we say tess.forward(100).

69
Q

module

A

A file containing Python definitions and statements intended for use in other Python programs. The contents of a module are made available to the other program by using the import statement.

70
Q

object

A

A “thing” to which a variable can refer. This could be a screen window, or one of the turtles you have created.

71
Q

range

A

A built-in function in Python for generating sequences of integers. It is especially useful when we need to write a for loop that executes a fixed number of times.

72
Q

sequential

A

The default behavior of a program. Step by step processing of algorithm.

73
Q

state

A

The collection of attribute values that a specific data object maintains.

74
Q

terminating condition

A

A condition that occurs which causes a loop to stop repeating its body. In the for loops we saw in this chapter, the terminating condition has been when there are no more elements to assign to the loop variable.

75
Q

turtle

A

A data object used to create pictures (known as turtle graphics).

76
Q

deterministic

A

A process that is repeatable and predictable.

77
Q

documentation

A

A place where you can go to get detailed information about aspects of your programming language.

78
Q

module

A

A file containing Python definitions and statements intended for use in other Python programs. The contents of a module are made available to the other program by using the import statement.

79
Q

pseudo-random number

A

A number that is not genuinely random but is instead created algorithmically.

80
Q

random number

A

A number that is generated in such a way as to exhibit statistical randomness.

81
Q

random number generator

A

A function that will provide you with random numbers, usually between 0 and 1.

82
Q

standard library

A

A collection of modules that are part of the normal installation of Python.

83
Q

chatterbox function

A

A function which interacts with the user (using input or print) when it should not. Silent functions that just convert their input arguments into their output results are usually the most useful ones.

84
Q

composition (of functions)

A

Calling one function from within the body of another, or using the return value of one function as an argument to the call of another.

85
Q

dead code

A

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

86
Q

fruitful function

A

A function that yields a return value instead of None.

87
Q

incremental development

A

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

88
Q

None

A

A special Python value. One use in Python is that it is returned by functions that do not execute a return statement with a return argument.

89
Q

return value

A

The value provided as the result of a function call.

90
Q

scaffolding

A

Code that is used during program development to assist with development and debugging. The unit test code that we added in this chapter are examples of scaffolding.

91
Q

temporary variable

A

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

92
Q

block

A

A group of consecutive statements with the same indentation.

93
Q

body

A

The block of statements in a compound statement that follows the header.

94
Q

boolean expression

A

An expression that is either true or false.

95
Q

boolean function

A

A function that returns a boolean value. The only possible values of the bool type are False and True.

96
Q

boolean value

A

There are exactly two boolean values: True and False. Boolean values result when a boolean expression is evaluated by the Python interepreter. They have type bool

97
Q

branch

A

One of the possible paths of the flow of execution determined by conditional execution.

98
Q

chained conditional

A

A conditional branch with more than two possible flows of execution. In Python chained conditionals are written with if … elif … else statements

99
Q

comparison operator

A

One of the operators that compares two values: ==, !=, >, =, and

100
Q

condition

A

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

101
Q

conditional statement

A

A statement that controls the flow of execution depending on some condition. In Python the keywords if, elif, and else are used for conditional statements.

102
Q

logical operator

A

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

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

104
Q

nesting

A

One program structure within another, such as a conditional statement inside a branch of another conditional statement.

105
Q

algorithm

A

A step-by-step process for solving a category of problems.

106
Q

body

A

The statements inside a loop.

107
Q

counter

A

A variable used to count something, usually initialized to zero and incremented in the body of a loop.

108
Q

cursor

A

An invisible marker that keeps track of where the next character will be printed.

109
Q

definite iteration

A

A loop where we have an upper bound on the number of times the body will be executed. Definite iteration is usually best coded as a for loop.

110
Q

escape sequence

A

An escape character, \, followed by one or more printable characters used to designate a nonprintable character.

111
Q

generalize

A

To replace something unnecessarily specific (like a constant value) with something appropriately general (like a variable or parameter). Generalization makes code more versatile, more likely to be reused, and sometimes even easier to write.

112
Q

infinite loop

A

A loop in which the terminating condition is never satisfied.

113
Q

indefinite iteration

A

A loop where we just need to keep going until some condition is met. A while statement is used for this case.

114
Q

iteration

A

Repeated execution of a set of programming statements.

115
Q

loop

A

A statement or group of statements that execute repeatedly until a terminating condition is satisfied.

116
Q

loop variable

A

A variable used as part of the terminating condition of a loop.

117
Q

nested loop

A

A loop inside the body of another loop.

118
Q

newline

A

A special character that causes the cursor to move to the beginning of the next line.

119
Q

reassignment

A

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

120
Q

tab

A

A special character that causes the cursor to move to the next tab stop on the current line.

121
Q

block

A

A group of consecutive statements with the same indentation.

122
Q

body

A

The block of statements in a compound statement that follows the header.

123
Q

boolean expression

A

An expression that is either true or false.

124
Q

boolean function

A

A function that returns a boolean value. The only possible values of the bool type are False and True.

125
Q

boolean value

A

There are exactly two boolean values: True and False. Boolean values result when a boolean expression is evaluated by the Python interepreter. They have type bool.

126
Q

branch

A

One of the possible paths of the flow of execution determined by conditional execution.

127
Q

chained conditional

A

A conditional branch with more than two possible flows of execution. In Python chained conditionals are written with if … elif … else statements.

128
Q

comparison operator

A

One of the operators that compares two values: ==, !=, >, =, and

129
Q

condition

A

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

130
Q

conditional statement

A

A statement that controls the flow of execution depending on some condition. In Python the keywords if, elif, and else are used for conditional statements.

131
Q

logical operator

A

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

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

133
Q

nesting

A

One program structure within another, such as a conditional statement inside a branch of another conditional statement.