Lab 1-1: Temperature Converter

Lab Requirements and Specifications

In this lab, you will be creating two different programs to convert temperature values between Fahrenheit and Celcius. One program will convert Fahrenheit to Celcius, and the other program will convert Celcius to Fahrenheit.

Each program should use input() to allow the user to type in a number to convert. The program will perform some math, then display an output formatted like:

0 C is equal to 32 F

To convert from Celcius to Fahrenheit, you would use the following equation:

\[T_f = T_c \times 1.8 + 32\]

To convert from Fahrenheit to Celcius, you would use the following equation:

\[T_c = \frac{(T_f - 32)}{1.8}\]

Where \(T_c\) is the temperature in Celcius and \(T_f\) is the temperature in Fahrenheit.

You should create two files in your workspace:
  • FILN_calcFtoC.py
  • FILN_calcCtoF.py

Where “FILN” is your first initial and last name, all lowercase, no space.

As a reminder, you should be running this program using python3. Running this program using python2 may give you unexpected results! If you are getting errors, make sure you look over your code and double-check for typos. If you are getting numbers that seem way off, make sure that the equations are entered in correctly! Don’t forget your order of operations!

Testing Your Program

You can test your program calcFtoC.py by feeding it the following (input) numbers and comparing your output to the result:

Input (F) Result (C)
32 0
-13 -25
100 37.777
63.8 17.666

You can test your program calcCtoF.py by feeding it the following (input) numbers and comparing your output to the result:

Input (C) Result (F)
0 32
25 77
100 212
-33 -27.4

The following space is provided in case you want to test code out or write it in the browser:

Next Section - Lab 1-2: Making Sense of Seconds