Is the water boiling?

EasyIf-Else Programs · 62 of 64

Write a Python program that reads a temperature in Fahrenheit and says whether water is boiling (212 °F or more).

Advertisement
Input
190
Output
Enter temperature in F: 190
Water is not boiling (22 degrees to go)

Approach

  1. Compare with 212.

Solution

Python
temp = float(input("Enter temperature in F: "))if temp >= 212:    print("Water is boiling")else:    print(f"Water is not boiling ({212 - temp:.0f} degrees to go)")
Outputtyped input: 190
Enter temperature in F: 190
Water is not boiling (22 degrees to go)

Line by line

Line 2

212 °F is the boiling point at sea level.

Advertisement

Learn the concept

New to this topic? Read the lesson, then come back.

More if-else programs

← All 64 If-Else Programs