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 Program to Print Output Without a Newline
Python String translate()
Python List sort()
Python Set update()
Python Variables, Constants and Literals
Python String partition()
Python Type Conversion and Type Casting
Machine Learning Mastery with Python - Understand your data, create accurate models and work project...
Python Anonymous / Lambda Function
Python staticmethod()
Python Dictionary items()
Deep Learning from Scratch - Building with Python form First Principles - Seth Weidman
Python Program to Get File Creation and Modification Date
Statistical Methods for Machine Learning - Disconver how to Transform data into Knowledge with Pytho...
Python Program to Capitalize the First Character of a String
Python Program to Shuffle Deck of Cards
Python List copy()
Python Program to Create Pyramid Patterns
Python Dictionary popitem()
Python super()
Python str()
Python if...else Statement
Python String isalpha()
Intelligent Projects Using Python - Santanu Pattanayak
Python filter()
Python Program to Return Multiple Values From a Function
Machine Learning with Python for everyone - Mark E.Fenner
Python bytearray()
Python vars()
Python List extend()
Python String count()
Python Program to Convert Bytes to a String