3. Booleans and conditional logic Flashcards
1
Q
What variable can take one of two values: True and False
A
bool
2
Q
How do you check if a is equal to b?
A
a == b
3
Q
How do you check if a is NOT equal to b
A
a != b
4
Q
What is the result of 3.0 == 3
A
True
5
Q
What is the result of '3.0' == 3
A
False
6
Q
What are the 3 conditional statements?
A
if elif else
7
Q
Which numbers are treated as True and False?
A
1 = True
All other numbers are False
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