question 256 Classes & Objects · medium
Temperature readings in the wrong unit
Weather stations report in Celsius or Fahrenheit, and Reading is meant to store every reading in Celsius so they can be compared. The charts show 41 °F stored as about 23 °C, some readings still say unit F, and stations that send a lower-case f are rejected. Fix Reading.__init__.
Class
Reading(station, value, unit="C")Stores
station; celsius, the value in Celsius rounded to 1 place (°C = (°F − 32) × 5 / 9); unit always "C"unit
"C" or "F" in either case; anything else raises ValueError