What is the current state of water?

★☆☆

In physics, a state of matter is one of the distinct forms in which matter can exist. Four states of matter are observable in everyday life: solid, liquid, gas, and plasma. Many intermediate states are known to exist, such as liquid crystal, and some states only exist under extreme conditions, such as Bose–Einstein condensates (in extreme cold), neutron-degenerate matter (in extreme density), and quark–gluon plasma (at extremely high energy).

States of water

Make

Write a program that outputs liquid state, solid state or gaseous state depending on the temperature of water in °C.

Success Criteria

Remember to add a comment before a subprogram or selection statement to explain its purpose.

Complete the subprogram called water_state so that it:

  1. Returns solid if the temperature is less than or equal to zero.
  2. Returns liquid if the temperature is greater than zero but less than one hundred.
  3. Returns gaseous if the temperature is greater than one hundred.

Complete the main program so that:

  1. The user can input the temperature in degrees centigrade.
  2. It outputs the state of the water.

Typical inputs and outputs from the program would be:

Enter the temperature in °C: 20
The water is in a liquid state.
Enter the temperature in °C: -8
The water is in a solid state.
Enter the temperature in °C: 106.89
The water is in a gaseous state.
🆘 If you're really stuck, use this Parsons code sorting exercise
Complete program
# States of water problem

# -------------------------
# Subprograms
# -------------------------
# Return the state of water
---
def water_state(centigrade):
---
    # Less than or equal to 0°
---
    if centigrade <= 0:
---
        return "solid"
---
    # Less than 100° but greater than 0°
---
    elif centigrade < 100:
---
        return "liquid"
---
    # 100° or above.
---
    else:
---
        return "gaseous"
---


# -------------------------
# Main program
# -------------------------
---
temperature = float(input("Enter the temperature in °C: "))
---
state = water_state(temperature)
---
print("The water is in a", state, "state.")