Task 1 (2 pt): A program that converts a temperature in F that the user provides and returns the equivalent temperature in C. Hint: Google is your friend! Given F, solve for C. This program does not require an if structure and has a straight forward input – process – output structure!
# Python program that gets temperature in Fahrenheit and converts to degrees Celsius
degreesInF = input("Enter temperature in Fahrenheit: ")
# Cast user input to int and convert to degrees Celsius
degreesInC = (int(degreesInF) - 32) * 5 / 9
# Display result in 2 decimal places
print("{:.2f}".format(degreesInC))
Comments
Leave a comment