Due: Friday, January 18, 2014 at 11:59pm
Points: 100
Please turn in your answers for the homework assignment on Canvas, under Homework 1 in Assignments.
Here, what the computer prints is in regular typewriter font, what you type is in italic typewriter font, and the symbol “↵” represents a return or enter.
Use a function to compute the approximation. Your program should print the output in exactly this form (note you must have exactly 2 digits after the decimal point):
Enter temperature in degrees C: 10↵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.27 millibars
Call this program “vp.py”, and put your answer in a comment at the beginning of the program.
Hint: One way to print the vapor pressure is to use the format string “"%6.2f" % vp(t)”, where t is the temperature and vp(t)> is the function to compute the vapor pressure from the temperature t.
temp pressurewith the proper numbers substituted for the “…”s. Again, only compute the vapor pressure to 2 decimal places. Call this program “vptable.py”.
---- --------
-20 1.26
…
50 124.02
Call this program “poly.py”.
Hint: Remember that a “regular polygon" is one that has sides of equal length, and all angles of equal size.
Here is the program:
ftemp = input("Enter degrees in Fahrenheit: ")
ctemp = 5 // 9 * (ftemp - 32)
print(ftemp, "degrees Fahrenheit is", ctemp, "degrees centigrade")
But there are two problems:
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.
You can also obtain a PDF version of this. | Version of January 4, 2019 at 12:06PM |