Convert Celsius to Fahrenheit in Python

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

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

Code listing to convert Celsius to Fahrenheit in Python

Below is the code listing for this program.

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

Output

Here is the output for the above program.

Convert Celsius to Fahrenheit in Python - Techronology

Developer’s note

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