3. Booleans and conditional logic Flashcards

1
Q

What variable can take one of two values: True and False

A

bool

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

How do you check if a is equal to b?

A

a == b

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

How do you check if a is NOT equal to b

A

a != b

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

What is the result of
3.0 == 3

A

True

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

What is the result of
'3.0' == 3

A

False

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

What are the 3 conditional statements?

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

Which numbers are treated as True and False?

A

1 = True
All other numbers are False

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

Which strings are treated as True and False?

A

All strings are True
Except for the empty string (“”) which is treated as False

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