Answers Already Passed
What happens if the condition in an `if` statement evaluates to false?
✔✔ The code block under the `if` statement is skipped, and Python moves to the next part of the
program.
How do you check if a number is divisible by 5?
✔✔ Use the condition `if number % 5 == 0:`.
What is the purpose of `elif` in a conditional structure?
✔✔ It allows checking multiple conditions in sequence, running the first block that is true.
What does the condition `if x > 10 and x < 20:` check?
✔✔ It checks if the value of `x` is between 10 and 20, exclusive.
What is the difference between `and` and `or` operators in conditional statements?
✔✔ `and` requires both conditions to be true, while `or` requires at least one condition to be true.
1
,How do you check if a value is not equal to another value?
✔✔ Use the condition `if value != another_value:`.
What is the result of the condition `3 > 5`?
✔✔ False.
What does the `not` operator do in a conditional expression?
✔✔ It inverts the truth value of a condition (e.g., `True` becomes `False`).
How do you write a condition to check if a list is empty?
✔✔ Use the condition `if not list:`.
What will happen if you use `if x > 10:` with `x = 5`?
✔✔ The code inside the `if` block will be skipped because the condition is false.
What will the following code output?
```
x=5
2
, if x < 10:
print("Small")
else:
print("Large")
```
✔✔ Small.
How do you write a condition to check if a number is odd?
✔✔ Use the condition `if number % 2 != 0:`.
What is the result of the expression `10 == 10`?
✔✔ True.
How do you check if a variable is less than 100?
✔✔ Use the condition `if variable < 100:`.
What will the following code output?
```
3