In this simple python program, we need to convert celsius to Fahrenheit. It's a beginner-level python program.
To understand this example, you should have knowledge of the following Python programming topics:
In this beginner python program, we have to understand what is mean by Celsius and Fahrenheit. Here we will learn Python program to convert Celsius To Fahrenheit. Both are units of temperature.
Celsius: It is a unit to measure the temperature and it is also known as centigrade. Celsius is the most commonly used unit of temperature. for example, the human normal temperature is 36.1°C. Celsius is denoted by 'C'.
Fahrenheit: is also used for measuring the temperature. normal commonly used Fahrenheit is in the thermometers to check the human temperature. it is denoted by 'F' In this python program we need to convert the Celsius to Fahrenheit, for that we have to use the formula which includes multiplication and addition in python T(F) = T(C) x 1.8 + 32. where the F is Fahrenheit and C is the Celsius.
STEP 1: Accept the input from the user for the temperature in Celsius using the input function in python and convert it to the float using the float data type and store the value in a variable.
STEP 2: Covert the Celsius to Fahrenheit by using the formula '(Celsius * 1.8) + 32 ' and store the result in Fahrenheit.
STEP 3: Print the result using the print function and using the 0.1 precision float value. 0.1 precision means the value will be 1 digit decimal.
celsius = float(input('Enter temperature in Celsius: ')) fahrenheit = (celsius * 1.8) + 32 print('%0.1f Celsius is equal to %0.1f degree Fahrenheit'%(celsius,fahrenheit))
Enter temperature in Celsius: 35 35 Celsius is equal to 95 degree Fahrenheit