![]() ![]() |
Conceptual Review (page 23 of 55) |
We can combine conditions using "and" or "or". With an "or" conditional only one of the conditions needs to evaluate to True for the entire expression to evaluate to True.
x = 4
if x >= 7 or x <= 3:
The above would evaluate to False because both sides of the "or" are False. If we changed x = 4 to x = 3, then it would evaluate to True because the second condition would be True. With an "and" conditional, all the conditions must evaluate to True for the entire expression to evaluate to True.
x = 4
y = 7
if x >= 7 or y == 3:
The above would evaluate to False because x is not greater than or equal to 7, which means both sides of the "and" are not True resulting in False.