Question: Complete the temp_converter function. Your function should be able to do the following: Celsius to Fahrenheit (C to F) Celsius to Kelvin (C to K)

Complete the temp_converter function.
Your function should be able to do the following:
Celsius to Fahrenheit (C to F)
Celsius to Kelvin (C to K)
Fahrenheit to Celsius (F to C)
Fahrenheit to Kelvin (F to K)
Kelvin to Celsius (K to C)
Kelvin to Fahrenheit (K to F)
I started the basics of the function. Finish writing this function.
def temp_converter(temp, unit='C', conv_unit='F'):
if unit == 'C':
# some code
return # some value
elif unit == 'F':
# some code
return # some value
elif unit == 'K':
# some code
return # some value
Your function should be to complete the following with no errors:
temp_converter(0, unit='C', conv_unit='F') => 32.0
temp_converter(0, unit='C', conv_unit='K') => 273.15
temp_converter(0, unit='F', conv_unit='C') => -17.78
temp_converter(0, unit='F', conv_unit='K') => 255.37
temp_converter(0, unit='K', conv_unit='C') => -273.15
temp_converter(0, unit='K', conv_unit='F') => -459.6

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!