Module 2: Making Decisions Flashcards

1
Q

True and False belong to type _____.

A

bool

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

x is not equal to y given by _____

A

!=

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

x is equal to y given by _____

A

==

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

x is greater than or equal to y given by ______

A

> =

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

x is less than or equal to y given by ____

A

<=

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

and, or and not are _______.

A

logical operators.

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

_______ are a header followed by an indented body.

A

compound statements

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

_____ limit on number of statements that can appear in the body but must have _____.

A

no, 1

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

to have a body with no statements use the ______ statement.

A

pass

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

___________ is a second form of if statement when there are two possibilities and the condition determines which one runs.

A

alternative execution

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

________ is when there are more than two possibilities and we need more than two branches.

A

chained conditionals

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

chained conditionals use: ________

A

if, elif, else or if, elif, elif

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

alternative execution uses ________.

A

if, else

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

alternatives are also called ________

A

branches

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

_______ is when an outer conditional has inner conditionals

A

nested conditional

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

a function that returns a boolean is a _______

A

predicate/predicate function

17
Q

boolean function names sound like _________

A

yes/no questions

18
Q

useful parts of an error message are ______ and _______.

A

what kind of error it was, where it occurred

19
Q

_______ is an operator that compares its operands

A

relational operator

20
Q

a _________ consists of a header and a body. the header ends with a : and body is indented relative to the header.

A

compound statement

21
Q

a ________ causes a function to end immediately and return to the caller.

A

return statement

22
Q

___________ is when a variable has a value and then gets a new value.

A

reassignment

23
Q

________ is a kind of reassignment where the new value of the variable depends on the old.

A

update

24
Q

before a variable can be updated, it must first be _______ with a simple assignment.

A

initialized

25
Q

Updating a variable by adding or subtracting 1 is called an _______ or ______.

A

increment, decrement

26
Q

The in-place operators for updating variables are:
x = x+a
x = x-a
x = x*a
x = x/a
x = x**a
x = x//a
x = x%a

A

x +=a
x -=a
x *=a
x /=a
x **=a
x //=a
x %=a