If you've ever visited Europe (or Canada) you'll know that they tend to measure temperature in degree Celsius rather than Fahrenheit. Conversion is pretty simple: if f is the temperature in degree Fahrenheit, then the temperature in degree Celsius is c = (f-32)*5/9. a. Write a function convert() that takes as an input degree Fahrenheit and returns degree Celsius. >>> convert(32) 0.0 >>> convert(68) 20.0 b. Using your
3. If you've ever visited Europe (or Canada) you'll know that they tend to measure
temperature in degree Celsius rather than Fahrenheit. Conversion is pretty simple: if f is
the temperature in degree Fahrenheit, then the temperature in degree Celsius is
c = (f-32)*5/9.
a. Write a function convert() that takes as an input degree Fahrenheit and
returns degree Celsius.
>>> convert(32)
0.0
>>> convert(68)
20.0
b. Using your function from part a. write a function table() that prints a
formatted look-up table that helps your European and Canadian friends figure out
the temperature in Chicago.
>>> table()
F C
-22.0 -30.0
-4.0 -20.0
14.0 -10.0
32.0 0.0
50.0 10.0
68.0 20.0
86.0 30.0
104.0 40.0
This question is about the formatting: make sure the temperatures are displayed
with the same precision as shown above and aligned as above.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images