Project: Celsius to Fahrenheit

Write a program that converts a temperature from Celsius to Fahrenheit with this formula:

F = (9/5)C + 32

where F is Fahrenheit and C is Celsius. The program reads a temperature in Celsius and prints the temperature in Fahrenheit. When you run it, the output should match this format:

Please enter the temperature in Celsius.
34.5
The corresponding temperature in Fahrenheit is:
94.1

Your result only needs to match to 7 decimal places. For example, 13.0999999999 counts as correct.

In the Problem Solving lesson you worked out the expected results for 0, 100 and -40 degrees Celsius. Run your program with those three values to test it.

Save the file as temp_conversion.py.

Show a solution

Try the project on your own first. This is one working solution. Press Run, and a box asks for each input. Type the sample values from the project description to see the same output.

These tests check the solution above. They run a copy of the program, kept in PROGRAM, and give it pretend input. The testing tools here are not part of the course yet, so do not worry about how they work. Read the test names and the expected outputs: together they list what the program must do. Press Run to run the tests.

Projects run on your own computer, so you tell us when you are done.