Given the temperature in degree Celsius. the task is to convert the value in the Fahrenheit scale and display it.
Examples :
Input : 37 Output : 37.00 Celsius is: 98.60 Fahrenheit Input : 40 Output : 40.00 Celsius is equivalent to: 104.00 Fahrenheit
Approach:
Take Celsius temperature as input from the user, apply the conversion formula of Fahrenheit from Celsius, and display it. The relationship between the Celsius scale and the Fahrenheit scale is given by :
Below is the implementation.
# Temprature in celsius degree celsius = 40 # Converting the temprature to # fehrenheit using the above # mentioned formula fahrenheit = (celsius * 1.8 ) + 32 # printing the result print ( '%.2f Celsius is equivalent to: %.2f Fahrenheit' % (celsius, fahrenheit)) |
Output:
40.00 Celsius is equivalent to: 104.00 Fahrenheit
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.