Sensor Reading Setup

Python for AIMedium+10 XP+10

Sensor Reading Setup

A weather station sends readings in Celsius. Each Reading should work out a couple of facts the moment it is made.

Fill in __init__ so that each reading has these attributes:

attributevalue
sensorthe sensor name, as given
celsiusthe temperature, as given
fahrenheitcelsius * 9 / 5 + 32, rounded to 1 decimal place
is_freezingTrue when celsius is 0 or below, otherwise False

Examples

Reading('garden', 10).fahrenheit
returns 50.0
Reading('garden', 10).is_freezing
returns False
Reading("roof", 20).fahrenheit
returns 68.0
Reading("lake", 0).is_freezing
returns True

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run