Q:

Write a Python program to convert temperatures to and from celsius, fahrenheit

0

Write a Python program to convert temperatures to and from celsius, fahrenheit

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

I have used python 3.7 compiler for debugging purpose.

temp = input("Input the  temperature you like to convert? (e.g., 25F, 90C 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.")

Result:

Input the  temperature you like to convert? (e.g., 25F, 90C etc.) : 37C

 

The temperature in Fahrenheit is 99 degrees.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Write a Python program to get the Fibonacci series... >>
<< Write a Python program to find those numbers which...