Chapter 3: Conditionals Flashcards

1
Q

The sequence of statements within a compound statement.

A

body

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

An expression whose value is either True or False.

A

boolean expression

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

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

A

branch

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

A conditional statement with a series of alternative branches (more than two)

A

chained conditional

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

One of the operators that compares its operands: ==, !=, >, <, >=, and <=.
Nonzero numbers are TRUE

A

comparison operator /
relational operator

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

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

A

conditional statement

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

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

A

condition

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

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

A

compound statement

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

Where we construct a logical expression with additional comparisons to take advantage of the short-circuit behavior and avoid errors

A

guardian pattern

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

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

A

logical operator

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

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

A

nested conditional

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

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

A

traceback

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

When Python is part-way through evaluating a logical expression and stops the evaluation because Python knows the final value for the expression without needing to evaluate the rest of the expression.

A

short circuit

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

Boolean order of priority

A

or
and
not

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

OR operator

A

Short-circuit operator, so it only evaluates the second argument if the first one is FALSE.

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

AND operator

A

Short-circuit operator, so it only evaluates the second argument if
the first one is TRUE

17
Q

NOT operator

A

Has a lower priority than non-Boolean operators, so not a == b is interpreted as not (a == b), and a == not b is a syntax error.

18
Q

ZeroDivisionError

A

error when you try to divide by zero

19
Q

pass

A

used in a function where you have a header but no body

20
Q

interactive mode print format

A

need a space between block statement and print statement

21
Q

alternative execution

A

IF-THEN-ELSE logic

22
Q

try/except

A

try:
desired code
except:
jumps here is desired code causes and error
eg. “Enter valid input”