Temperature conversion calculates an equivalent value between defined temperature scales. As a small function-design task, specify the input, processing, and expected output clearly. section 3.7
The demonstrated conversion breaks into three parts:
- Input: receive a temperature value. section 3.7
- Process: subtract 32 and multiply by 5.0/9.0. section 3.7
- Output: return the Celsius value. section 3.7
Prompt: Write a Python function to convert temperature between Fahrenheit and Celsius.
def convert_temperature(temp):
celsius = (temp - 32) * 5.0/9.0
return celsius
Inspect the compact Python implementation of Fahrenheit-to-Celsius conversion. section 3.7
