Program to convert Celsius to Fahrenheit in Python

Program to convert Celsius to Fahrenheit in Python

In this section, you will learn how to convert Celsius into Fahrenheit and Fahrenheit into Celsius in Python Programming.

Units of measurement of temperature in Celsius and Fahrenheit. Let's look at the conversion principles for converting a temperature in degrees Celsius to degrees Fahrenheit and vice versa.

Celsius = (Fahrenheit - 32) * 5/9

Fahrenheit = (Celsius * 9/5) + 32

Now take a look at the code how to write a Program to convert Celsius to Fahrenheit and vice-versa.

Python code:

a = float(input("enter temperature in celsius ="))
convfactor = (a*9)/5+32
print("temperature in fahrenheit =", convfactor)
b = float(input("enter temperature in fahrenheit ="))
convfac = (b-32)/1.8
print("temprature in celsius is =", convfac)
Output:
enter temperature in celsius = 46
temperature in fahrenheit = 114.8
enter temperature in fahrenheit = 114.8
temprature in celsius is = 46.0

Recommended Post:
Python Program to check vowel or Consonant
Program to check character is alphabet or not in Python
Python to check whether the year is leap or not
Python to check if number is Positive, Negative or 0
Python Program to solve Quadratic equation
Program to generate Random numbers in Python
Program to swap two numbers in Python
Program to Add two numbers in Python
Python to convert decimal to binary, octal and hexadecimal

Python Program to find large number among three numbers
How to find absolute value of a number in Python
Program to add two binary numbers using bin function