31-Oct-2022
.
Admin
Hi Dev,
In this tutorial, you will learn Python Program to Convert Celsius to Fahrenheit. I explained simply about How to write a Python program to convert celsius to fahrenheit. I explained simply about Convert temperature from celsius to Fahrenheit in Python. We will look at example of Python Exercise: Convert temperatures to and from celsius.
Python program to convert celsius to fahrenheit; In this tutorial, you will learn how to convert temperature from Celsius to Fahrenheit and Fahrenheit to celsius.
let's see below simple example with output:
Example 1: Python program to convert temperature from Celsius to Fahrenheit
Converts the entered value into Fahrenheit using this formula fahrenheit = (celsius * 9/5) + 32.
Print result.
# Python program to convert temperature from Celsius to Fahrenheit
celsius = float(input("Enter temperature in celsius :- "))
fahrenheit = (celsius * 9/5) + 32
print('%.2f Celsius is :- %0.2f Fahrenheit' %(celsius, fahrenheit))
Output:
Enter temperature in celsius :- 10
10.00 Celsius is :- 50.00 Fahrenheit
Example 2: Python program to convert Fahrenheit to Celsius
Converts the entered value into Celsius using this formula celsius = (fahrenheit – 32) * 5/9.
Print result.
# Python program to convert Fahrenheit to Celsius
fahrenheit = float(input("Enter temperature in fahrenheit :- "))
celsius = (fahrenheit - 32) * 5/9
print('%.2f Fahrenheit is :- %0.2f Celsius' %(fahrenheit, celsius))
Output:
Enter temperature in fahrenheit :- 70
70.00 Fahrenheit is :- 21.11 Celsius
I hope it can help you...
#Python