2.2.1 Boolean Variables & Relational Operators

Unit: Unit 2: Decision Making & Conditionals • Interactive Practice

Quick Answer & Summary:

Interactive Python programming tutorial and practice in your browser.

Interactive Challenge (Run Live in Browser):

# Compare temperature thresholds for a server room
current_temp = 28.5
max_safe_temp = 25.0
min_safe_temp = 15.0

is_too_hot = current_temp > max_safe_temp
is_too_cold = current_temp < min_safe_temp
is_exactly_nominal = current_temp == 20.0

print("Current Temp:", current_temp)
print("Is Too Hot:", is_too_hot)
print("Is Too Cold:", is_too_cold)
print("Is Exactly Nominal:", is_exactly_nominal)
Open in Live Interactive Python Sandbox →