Write a Python function named Celsius that converts a given temperature from Fahrenheit to Celsius. The input is the temperature in Celsius and the return value is the temperature in Fahrenheit. The conversion formula is C =5/9(F − 32),C and F are the temperatures in Celsius and Fahrenheit respectively. Then use a loop to convert the following temperatures 25.2, 75.4, 100.0, 37.48, 0.0, −15.45 to Fahrenheit and print the results in a tabular form.#python
Answers
Answered by
0
Answer:
here is your answer mate
Explanation:
temp = input("Input the temperature you like to convert? (e.g., 45F, 102C etc.) : ")
degree = int(temp[:-1])
i_convention = temp[-1]
if i_convention.upper() == "C":
result = int(round((9 * degree) / 5 + 32))
o_convention = "Fahrenheit"
elif i_convention.upper() == "F":
result = int(round((degree - 32) * 5 / 9))
o_convention = "Celsius"
else:
print("Input proper convention.")
quit()
print("The temperature in", o_convention, "is", result, "degrees.")
Similar questions