Due: Thursday, January 23, 2018 at 11:59 p.m.
Please turn in your answers for the homework assignment on Canvas under Homework #1 in Assignments.
Your program should print the output in exactly this form (you may change the number of digits after the decimal point, but you must have at least two):
Enter temperature in degrees C: 10↵Here, what the computer prints is in regular font, what you type is in italic font, and the symbol “↵” represents a return or enter. Use your program to estimate the temperature at which the vapor pressure is approximately 10 millibars (to two decimal places).
At this temperature, the vapor pressure is approximately 12.2716959939 millibars
Call this program “vp.py”, and put your answer in a comment at the beginning of the program.
Hint: To use the math module, put the line import math at the beginning of your program
Here is the program:
ftemp = raw_input("Enter degrees in Fahrenheit: ")But there are two problems:
ctemp = 5 / 9 * (ftemp - 32)
print ftemp, "degrees Fahrenheit is", ctemp, "degrees centigrade"
Please fix both these problems, so the program converts Fahrenheit to Celsius correctly. The program must handle floating point numbers, so entering “32.5” should produce a (small) real number, not a ValueError.
Call your fixed program “ftoc.py”, and explain what caused the two problems in a comment at the beginning of the program.
Last modified: January 6, 2018 at 7:48PM|
Winter Quarter 2018
You can get a PDF version of this