Convert Fahrenheit to Celsius in Python

This Python code shows you how to convert Fahrenheit temperatures to Celsius.

Of course, you are free to make it better. All you really need is the formula.

Code listing to convert Fahrenheit to Celsius in Python

Below is the code listing for this program.

# ---------------------------------------------
# fahrenheit_to_celsius.py
# Designed and programmed by Alex Shaw III
# Date created:  January 4, 2023
# Last modified: January 4, 2023
#
# This program converts Fahrenheit to Celsius 
# ---------------------------------------------
 
fahTemp = input('Enter a Fahrenheit temperature: ')
 
celTemp = (float(fahTemp) - 32) * (5 / 9)
 
print(str(fahTemp) + ' degrees Fahrenheit is ' + 
      str(celTemp) + ' degrees Celsius.')

Output

Here is the output for the above program.

Convert Fahrenheit to Celsius in Python - Techronology

Developer’s note

We did not put any comments for the code in this program. We think you got it.

If you have any questions or comments, then send us an email at support@techronology.com.

Related


Python page

Click on the button below to go to our Python page.

Python page


Create a menu in Python - Techronology

Python is a high-level computer programming language. If you want more information on Python, then visit Python Software Foundation.


Techronology home  Code library  Reference desk