Due: October 6, 2021
Points: 100
In the given examples, what you type is in red and the program prints what is in black. Your program output should look exactly like the output in the examples, except that what you type won’t be in red.
Write a program that prompts the user for a weight in pounds and converts it to ounces and kilograms. The temperature may be an integer or a real number. Round the temperatures to two places in the output.
Assume the input is valid; that is, the user will enter a real number.
To turn in: Please turn in the program in the file weightcvt.py.
Hint: Use the function round(x, 2) to round x to two places. For example, say round(2.3456, 2) to round 2.3456 to two places.
Examples:
Enter weight in pounds: 1 1.0 pounds is 16.0 ounces and 0.45 kilograms
Enter weight in pounds: 435 435.0 pounds is 6960.0 ounces and 197.31 kilograms
Enter weight in pounds: 1237 1237.0 pounds is 19792.0 ounces and 561.09 kilograms
Assume that the input is valid; that is, the user will enter a positive integer.
To turn in: Please turn in the program in the file grade.py.
Examples:
Enter number: 16 The sum of multiples of 3 and 5 less than or equal to 16 is 60
Enter number: 10 The sum of multiples of 3 and 5 less than or equal to 10 is 33
Enter number: 102 The sum of multiples of 3 and 5 less than or equal to 102 is 2520
Enter number: 1000 The sum of multiples of 3 and 5 less than or equal to 1000 is 234168
Write a program that iterates through the number of units, beginning with 0, and stop when the cost of the number of units is greater than the cost of the previous number of units. Print the number of units, and the cost, until this happens.
Note the number of units must be a whole, nonnegative number; no fractional units allowed!
To turn in: Please turn in the program in the file costs.py.
Examples:
The cost of producing 0 units is $ 432 The cost of producing 1 units is $ 426
To turn in: Please turn in the program in the file cd.py.
Examples:
Number of days: 150 After 150 days, the number of deaths predicted is 95029
Number of days: 30 After 30 days, the number of deaths predicted is 1152
Number of days: 8 The number of days must be at least 18
|
MHI 289I, Programming in Health Informatics Version of September 22, 2022 at 11:33PM
|
You can also obtain a PDF version of this. |