Comp Sci 2026 Computer Science 2026

Assignment: Fix the Variables

Due 9/14 at 11:59pm

In this assignment you will fix a broken Python program.

The program is supposed to ask the user for the current temperature, calculate the difference between the current temperature and the freezing point of water, and print the result.

However, the program is unfinished. Your job is to add code where the TODO comments are so that the program works as expected.

Paste the following code into a new Python project:

# TODO: Define the units of temperature (e.g. "Fahrenheit")

# Ask the user for the current temperature
temperature = input("Enter the current temperature in " + units + ": ")

# Convert the temperature to a float
numeric_temperature = float(temperature)

# TODO: Define the freezing point of water

# Calculate the difference between the current temperature and the freezing point of water
difference = numeric_temperature - freezing_point

# Print the result
print("The current temperature is: " + str(numeric_temperature) + " degrees " + units)
print("The freezing point of water is: " + str(freezing_point) + " degrees " + units)
print("The difference between the current temperature and the freezing point of water is: " + str(difference) + " degrees " + units)

When you’ve finished, upload the .py file to ThinkWave.