print("Hello, this is a temperature conversion program!")
while True:
temperature = input("What is the temperature that you will be converting? (Ex: 45F, 102C, etc.): ")
degrees = int(temperature[:-1])
convertor = temperature[-1]
if convertor.upper() == "C":
calculation = int(round((9 * degrees) / 5 + 32))
conversion = "Fahrenheit"
elif convertor.upper() == "F":
calculation = int(round((degrees - 32) * 5 / 9))
conversion = "Celsius"
else:
print("Error. Enter a valid input.")
quit()
print("The temperature in", conversion, "is", calculation, "degrees.")
print("")
goAgain = input("Do you want to calculate the temperature again? (Yes or No): ")
if goAgain == "No" or goAgain == "no":
print("Have a Good Day!!")
break
What is the temperature that you will be converting? (Ex: 45F, 102C etc.): 45C The temperature in Fahrenheit is 113 degrees. Do you want to calculate the temperature again? (Yes or No): yes What is the temperature that you will be converting? (Ex: 45F, 102C etc.): 102F The temperature in Celsius is 39 degrees. Do you want to calculate the temperature again? (Yes or No): no Have a Good Day!!