Chapter 2 Flashcards

1
Q

assignment operator

A

= is Python’s assignment operator, 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
2
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 operator 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
3
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
4
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
5
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
6
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 (type int), floating-point numbers (type float), and strings (type str).

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

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

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 diagram

A

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

17
Q

statement

A

An instruction that the Python interpreter can execute. Examples of statements include the assignment statement and the print 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.