Program to convert Celsius to Fahrenheit in Python

Program to convert Celsius to Fahrenheit in Python Language. It is a basic program. It is necessary for beginners, CBSE class 11 , 12 and B Tech Computer Science students.

Write a Program to convert Celsius to Fahrenheit

What is Celsius ?
The degree Celsius is a unit of temperature on the Celsius scale , a temperature scale originally known as the centigrade scale. The degree Celsius (symbol: °C) can refer to a specific temperature on the Celsius scale or a unit to indicate a difference or range between two temperatures. It is named after the Swedish astronomer Anders Celsius (1701–1744).

What is Fahrenheit ?
The Fahrenheit scale is a temperature  scale based on one proposed in 1724 by the physicist Daniel Gabriel Fahrenheit   (1686–1736). It uses the degree Fahrenheit (symbol: °F) as the unit. The original paper suggests the lower defining point, 0 °F, was established as the freezing temperature of a solution of brine made from a mixture of water, ice , and ammonium chloride  (a salt).

Mathematical calculation for conversion :

We can input the degree Celsius temperature and apply the conversation formula of degree Fahrenheit from degree Celsius and display it on screen. The following is the relationship of degree Celsius and degree Fahrenheit:
T(°Fahrenheit)=(T(°Celsius)*1.8)+32

Source code :

celsius_1 = float(input("Temperature value in degree Celsius: " ))  
  
# For Converting the temperature to degree Fahrenheit by using the above  
# given formula  
Fahrenheit_1 = (celsius_1 * 1.8) + 32  
    
# print the result  
print('The %.2f degree Celsius is equal to: %.2f Fahrenheit'  
      %(celsius_1, Fahrenheit_1))  
 

Click below button to Download Source Code

Step wise Source code Explanation

Step 1 : We will capture the Celsius value in float format.
celsius_1 = float(input(“Temperature value in degree Celsius: ” ))
Step 2: Formula is used to calculate Fahrenheit from Celsius.
Fahrenheit_1 = (celsius_1 * 1.8) + 32
Step 3: The Fahrenheit value is printed by float value.
print(‘The %.2f degree Celsius is equal to: %.2f Fahrenheit’
%(celsius_1, Fahrenheit_1))

Output :

Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> 
 RESTART: C:/Users/ARCHIT/AppData/Local/Programs/Python/Python37-32/test1.py 
Temperature value in degree Celsius: 32
The 32.00 degree Celsius is equal to: 89.60 Fahrenheit
>>> 

Aim: Write a Program To Convert Degree Fahrenheit into Degree Celsius.

The user can use the following formula for converting degree Fahrenheit into degree Celsius:

program to convert Celsius to Fahrenheit in python

Source code :

Fahrenheit_1 = float( input("Temperature value in degree Fahrenheit: " ))  
  
# For Converting the temperature from degree Fahrenheit to degree Celsius   
# by using the above given formula  
celsius_1 = (Fahrenheit_1 - 32)  / 1.8  
    
# Print the result  
print ('The %.2f degree Fahrenheit is equal to: %.2f Celsius'  
      %(Fahrenheit_1, celsius_1))  

Step 1 : We will capture the Fahrenheit value in float format.
Fahrenheit_1 = float( input(“Temperature value in degree Fahrenheit: ” ))
Step 2: Formula is used to calculate Celsius from Fahrenheit.
celsius_1 = (Fahrenheit_1 – 32) / 1.8
Step 3: Celsius value is printed by float value.
print (‘The %.2f degree Fahrenheit is equal to: %.2f Celsius’
%(Fahrenheit_1, celsius_1)))

Output :

Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> 
 RESTART: C:/Users/ARCHIT/AppData/Local/Programs/Python/Python37-32/test1.py 
Temperature value in degree Fahrenheit: 123
The 123.00 degree Fahrenheit is equal to: 50.56 Celsius
>>> 

Conclusion:

Conversion of Celsius to Fahrenheit and vice-versa is done.

Thank you for reading and learning from the Program to convert Celsius to Fahrenheit and vice-versa in Python.. It is necessary for beginners, CBSE class 11 , 12 and B tech Computer science students. More programs are given below :

Python Programs Archives – CS Study

Computer Science with Python Practical Book Solutions Class 11 Term -2 – CS Study

Computer Science Practical file for class 12 Term-2 – CS Study

Leave a Comment

Your email address will not be published.