Chapter 2 Flashcards

1
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
2
Q

assignment token

A

= is Python’s assignment token. Do not confuse it with equals, which is an operator for comparing values.

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

composition

A

The ability to combine simple expressions and statements into compound statements and expressions in order to represent complex computations concisely.

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

concatenate

A

To join two strings end-to-end.

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

data type

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
6
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
7
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
8
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
9
Q

floor division

A

An operator (denoted by the token //) that divides one number by another and yields an integer, or, if the result is not already an integer, it yields the next smallest integer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
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
11
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
12
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
13
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
14
Q

operator

A

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

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

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

18
Q

str

A

A Python data type that holds a string of characters.

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

20
Q

variable

A

A name that refers to a value.

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