This post was last Updated on June 8, 2023 by Himanshu Tyagi to reflect the accuracy and up-to-date information on the page.
In this tutorial, you will learn a simple Python 3 program to convert Celsius to Fahrenheit and Fahrenheit to Celsius. Before moving ahead, make sure you know about Python programming basics.
Also Check: Sending Emails Using Python With Image And PDF Attachments.
Python 3 Program To Convert Celsius To Fahrenheit
To convert Celsius to Fahrenheit, we will use this formula: Fahrenheit = (celsius * 1.8) + 32.
Source Code:
celsius = float(input("Enter temperature in celsius: ")) fahrenheit = (celsius * 1.8) + 32 print('%0.1f celsius = %0.1f Fahrenheit' % (celsius, fahrenheit))
Run The Program
Output
Other Python Programs:
- Python 3 Program To Swap Two Numbers.
- Python 3 Program To Solve A Quadratic Equation.
- Python 3 Program to Calculate The Area of a Triangle.
- Python 3 Program To Add Two Numbers.
- Python 3 Program to Find the Square Root of A Number
Python 3 Program To Convert Fahrenheit to Celsius
To convert Fahrenheit to Celsius, we will use this formula: Celsius = (Fahrenheit – 32) / 1.8
fahrenheit = float(input("Enter temperature in Fahrenheit: ")) celsius = (fahrenheit - 32) / 1.8 print('%0.1f Fahrenheit = %0.1f Celsius' % (fahrenheit, celsius))
Run The Program
Output
Other Python Programs:
- Python 3 Program To Find the Largest Element In An Array or List.
- Python 3 Program To Find The Sum of An Array.
- Python 3 Program to Convert Kilometres to Miles.
- Python 3 Program to Generate A Random Number.
- Python 3 Program To Add Two Matrices.
- Python 3 Program to Check Armstrong Number.
- Python 3 Program to Find the Sum of Natural Numbers.
- Python 3 Program To Find The Factorial Of A Number.