In this program, you’ll learn to convert Celsuis to Fahrenheit and display it.
To understand this example, you should have the knowledge of the following Python programming topics:
In the program below, we take a temperature in degree Celsius and convert it into degree Fahrenheit. They are related by the formula:
celsius * 1.8 = fahrenheit - 32
Source Code
# Python Program to convert temperature in celsius to fahrenheit # change this value for a different result celsius = 37.5 # calculate fahrenheit fahrenheit = (celsius * 1.8) + 32 print('%0.1f degree Celsius is equal to %0.1f degree Fahrenheit' %(celsius,fahrenheit)
Output
37.5 degree Celsius is equal to 99.5 degree Fahrenheit
We encourage you to create a Python program to convert Fahrenheit to Celsius on your own using the following formula
celsius = (fahrenheit - 32) / 1.8
Related posts:
Python bytearray()
Python Anonymous / Lambda Function
Python Keywords and Identifiers
Python Directory and Files Management
Python Global, Local and Nonlocal variables
Python String capitalize()
Python Deeper Insights into Machine Learning - Sebastian Raschka & David Julian & John Hearty
Python Program to Check if a Number is Odd or Even
Python Data Analytics with Pandas, NumPy and Matplotlib - Fabio Nelli
Python Program to Return Multiple Values From a Function
Python Program to Get File Creation and Modification Date
Python String istitle()
Python Program to Get the File Name From the File Path
Python Functions
Python Inheritance
Python String rpartition()
How to Get Started With Python?
Python Program to Convert String to Datetime
Python Program to Count the Number of Occurrence of a Character in String
Python String find()
Python Machine Learning Second Edition - Sebastian Raschka & Vahid Mirjalili
Python Input, Output and Import
Python Objects and Classes
Python *args and **kwargs
Python abs()
Python Tuple
Python object()
Python 3 for Absolute Beginners - Tim Hall & J.P Stacey
Python Program to Find the Size (Resolution) of a Image
Python Program to Display Fibonacci Sequence Using Recursion
Python String isnumeric()
Python callable()