Question: Python 3.7 1. Write a program that converts temperature from F, C, K using functions. PLEASE EDIT THIS CODE I ALREADY HAVE TO INCLUDE KELVIN

Python 3.7 1. Write a program that converts temperature from F, C, K using functions.

PLEASE EDIT THIS CODE I ALREADY HAVE TO INCLUDE KELVIN

def convert_to_fahrenheit(temp):

result = 9/5 * temp + 32

return result

def convert_to_celsius(temp): result = 5/9 * (temp-32)

return result

# where the fun begins

temperature = int(input("Enter degrees: "))

scale = input("Enter C for Celsius or F for Fahrenheit: ")

scale = scale.strip().upper()

if scale == "C":

converted_temp = convert_to_fahrenheit(temperature)

print("The temperature in Fahrenheit is %.2f." % converted_temp)

elif scale == "F": converted_temp = convert_to_celsius(temperature)

print("The temperature Celsius is %.2f." % converted_temp)

else: print("Wrong answer")

Please edit this code to include the conversion for Kelvin as well. thank you.

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!