Note 04: Branching¶
Branching lets a program choose between actions.
temperature = float(input("Temperature: "))
if temperature < 32:
print("Freezing")
elif temperature < 60:
print("Cool")
else:
print("Mild or warm")
Comparisons¶
Use comparison operators such as ==, !=, <, <=, >, and >=.
Logical operators combine conditions:
andornot
Check the Boundaries¶
When a program splits values into ranges, test values at the edges of those ranges. Boundary mistakes are common and worth catching early.