In this python program, we will learn how to convert celsuis to farenheit in python and display it using the print function.
This program takes the input in celsius degree and then converts it to farenheit degree. The farenheit is usually calculated using the below formula
farenheit = (celsius * 1.8) + 32
How to convert Celsius to Fahrenheit in Python?
# Author : Abandantcode.com # Program to convert celsius to fahrenheit # input/you can usually use the input function to get this value. It is hardcoded to 34 in this example celsius = 34 # calculate fahrenheit using the formula fahrenheit = (celsius * 1.8) + 32 print('%0.1f Celsius = %0.1f Fahrenheit' %(celsius,fahrenheit))
Output
34.0 Celsius = 93.2 Fahrenheit
Alternatively, you can convert fahrenheit to celsius by using the below formula
celsius = (fahrenheit – 32) / 1.8
Leave a Reply