Python Program to convert Celsius to Fahrenheit

Python Program to convert Celsius to Fahrenheit

In this article, we will see Python Program to convert celsius to Fahrenheit. Before proceeding, we should have basic knowledge of the below topics.

Python Data Types
Python type conversion
Python operators

Python Program to Convert Celsius To Fahrenheit

While doing any program we must know the following :

  • What’s the logic behind the program
  • How do you justify that logic
  • Which things are required?
  • What we should take as input and what we should bring in from our end 

There is a formula for converting a Celsius temperature to a Fahrenheit temperature. 

fahrenheit = celsius * 1.8 + 32

Python Program to Convert Celsius to Fahrenheit :

print("Enter the temperature in Celsius")
celsius = float(input())
fahrenheit = (celsius * 1.8) + 32
print(celsius,"celsius degree is equal to the",fahrenheit,"fahrenheit degree")


Output :

Enter the temperature in Celsius
12.5
12.5 celsius degree is equal to the 54.5 fahrenheit degree

Here, we convert the user input into float because python takes input only in string pattern. Let’s see the vice versa of this program i.e. Fahrenheit to Celsius.

The formula for converting Fahrenheit temperature to celsius temperature is :

celsius = (fahrenheit - 32)/1.8

Python Program to convert Fahrenheit Celsius to :

print("Enter the temperature in Celsius")
fahrenheit = float(input())
celsius = (fahrenheit - 32)/1.8
print(fahrenheit,"fahrenheit degree is equal to the",celsius,"celsius degree")


Output :

Enter the temperature in Celsius
54.5
54.5 fahrenheit degree is equal to the 12.5 celsius degree

Discover Our Exciting Courses and Quiz

Enroll now to enhance your skills and knowledge!

Python Online Quiz

Level up your coding skills with our interactive programming quiz!