< Back

Post Lab 8

Post labs are to be done individually. Sharing files between students is not allowed. Doing so is an Academic Integrity violation, and will be treated as such.


One of the uses of fruitful functions is to write functions that perform various unit conversions. Already this semester you've re-written the code to convert from kilometers to meters, years to seconds, and vice-versa. However, you can write a function once and reuse that code in many different programs. Today you will demonstrate your knowledge of fruitful functions by writing a function to convert temperatures.

Details

Create a function called fahrenheit_to_celsius(degrees_fahrenheit) in a file called temperatures.py. This function should take as a parameter a floating point value representing the temperature in Fahrenheit and return a floating point value representing the temperature in Celsius.

Recall that the equation to convert from Fahrenheit to Celsius is:

$$ C = (F - 32) \times \frac{5}{9}$$

Test your function by calling the function multiple times with different parameters. Make sure you use proper variable names follow the course's code conventions.

Test Cases

Function Parameters Expected Output
-15 -26.11111111111111
0 -17.77777777777778
32 0.0
100 37.77777777777778
212 100.0

Submission

Submissions for post labs are to be done via the inquire system. Go to http://inquire.roanoke.edu/ You should see a section for post labs. Submit your .py file to the appropriate post lab location.

Post labs are to be done individually. Sharing files between students is not allowed. Doing so is an Academic Integrity violation, and will be treated as such.