Choose what happens next
Use comparisons and Boolean logic to flag an asset for review.
Turn a comparison into a decision
A comparison produces True or False. == tests equality, != tests inequality, and <, <=, >, and >= compare ordered values. Do not confuse = (assignment) with == (comparison).
An if statement evaluates its condition, then runs the indented block when the result is true. elif adds another branch; else handles the remaining cases. A colon starts each block. Use four spaces for indentation and keep all statements in a block aligned.
Combine conditions deliberately
and requires both conditions; or accepts either. not reverses a Boolean value. Read the whole expression aloud: “CPU at or above 85, or free disk below 10.” That wording determines both the operator and the boundary.
A value exactly on a threshold deserves attention in your tests. Less-than and less-than-or-equal are different rules. Keep a Boolean result as a Boolean, then choose a readable label for people. The string "False" is nonempty text and therefore truthy; it is not the Boolean False.
cpu_percent = 42
if cpu_percent >= 85:
print("review")
else:
print("ready")
Put it into practice.
For cpu_percent = 70 and disk_free_gb = 8, set needs_attention to True when CPU is at least 85 OR free disk is below 10. Set status to review or ready accordingly, and print it.
See an explained solution
cpu_percent = 70
disk_free_gb = 8
needs_attention = cpu_percent >= 85 or disk_free_gb < 10
if needs_attention:
status = "review"
else:
status = "ready"
print(status)
The Boolean captures the rule, and the conditional chooses a label. With these inputs, low free disk is enough to trigger review.