← Back to Classes
Question 511
Freezing Point Check
Freezing Point Check
Write the whole Temperature class. The constructor stores celsius as a float; to_fahrenheit() returns celsius * 9 / 5 + 32; is_freezing() returns True at 0 or below; describe() prints <celsius> C is <fahrenheit> F, freezing when is_freezing is true and the same line ending in not freezing otherwise, calling the other two methods rather than repeating their formulas. Do NOT write a main block or any top-level test code; the tests construct the class. Input: one line, the Celsius value, which the tests read as a float; they call describe and then print what is_freezing returns.
Expected Output:
-5.0 C is 23.0 F, freezing True
= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
Classes
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.