Answer:
Examples.....
Enter the temperature in Celsius: 36
96.8°F
Enter the temperature in Fahrenheit: 108
42.222°C
Explanation:
print("Choose from 1 and 2:- ")
option = int(input(" 1. Fahrenheit to Celsius conversion: \n 2. Celsius to Fahrenheit conversion: \n" ))
if option == 1: #(Fahrenheit to Celsius)
inFahrenheit = float(input("Enter the temperature in Fahrenheit: "))
#formula to convert Fahrenheit into Celsius
#celsius = (Fahrenheit- 32) 8 5/9
inCelsius = (inFahrenheit - 32) * 5/9
print("%.3f" % inCelsius + "°C")
elif option == 2: #(Celsius to Fahrenheit)
inCelsius = float(input("Enter the temperature in Celsius: "))
#formula to convert Celsius to Fahrenheit
#Fahrenheit = celsius * 9/5 +32
inFahrenheit = (inCelsius * 9/5) + 32
print("%.1f" % inFahrenheit +"°F")
else:
print("wrong option selected. Choose 1 or 2")
Copyright © 2024 EHUB.TIPS team's - All rights reserved.
Answers & Comments
Answer:
Examples.....
Enter the temperature in Celsius: 36
96.8°F
Enter the temperature in Fahrenheit: 108
42.222°C
Explanation:
print("Choose from 1 and 2:- ")
option = int(input(" 1. Fahrenheit to Celsius conversion: \n 2. Celsius to Fahrenheit conversion: \n" ))
if option == 1: #(Fahrenheit to Celsius)
inFahrenheit = float(input("Enter the temperature in Fahrenheit: "))
#formula to convert Fahrenheit into Celsius
#celsius = (Fahrenheit- 32) 8 5/9
inCelsius = (inFahrenheit - 32) * 5/9
print("%.3f" % inCelsius + "°C")
elif option == 2: #(Celsius to Fahrenheit)
inCelsius = float(input("Enter the temperature in Celsius: "))
#formula to convert Celsius to Fahrenheit
#Fahrenheit = celsius * 9/5 +32
inFahrenheit = (inCelsius * 9/5) + 32
print("%.1f" % inFahrenheit +"°F")
else:
print("wrong option selected. Choose 1 or 2")