Due: October 15, 2020
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, and the results may differ in the last few digits.
To turn in: Please turn in the program in the file flattax.py.
Examples:
What is the income? 124598 The tax on income of 124598 is 21181.66
What is the income? -250 The tax on income of -250 is -42.5
What is the income? 124,598 Error – invalid input entered; put in an integer
To turn in: Please turn in the program in the file cone.py.
Examples:
Radius of base of cone: 1 Height of cone: 5 The volume of a cone with radius 1.0 and height 5.0 is 5.235987755982989
Radius of base of cone: 2.3 Height of cone: 3.4 The volume of a cone with radius 2.3 and height 3.4 is 18.834895155822
Radius of base of cone: 1/5 Error – radius must be a real number
Radius of base of cone: 1 Height of cone: 3*4 Error – height must be a real number
To turn in: Please turn in the program in the file si.py.
Examples:
Number of days: 30 After 30 days, the proportion of the population infected is 0.287664368675717
Number of days: 40 After 40 days, the proportion of the population infected is 0.7489923252324207
Number of days: 10.3 You must enter an integer number of days
To turn in: Please turn in the program in the file siloop.py.
Example:
Number of days: 10 1 0.0012211323960795992 2 0.00149109134209279 3 0.0018206220327889482 4 0.0022228167755574827 5 0.0027136190661283567 6 0.0033124316939081035 7 0.00404284825698398 8 0.004933530020258307 9 0.006019252361985584 10 0.007342146711703001
To turn in: Please turn in the program in the file siloop2.py.
Example:
Number of days: 180 How often to print (first, last always printed): 15 15 0.019709372957867413 30 0.287664368675717 45 0.8902449144669539 60 0.9938993778932189 75 0.9996944969424588 90 0.9999847854817202 105 0.999999242502787 120 0.9999999622864073 135 0.9999999981223507 150 0.9999999999065173 165 0.9999999999953458 180 0.9999999999997683
|
MHI 289I, Programming for Health Informatics Version of October 1, 2020 at 11:38AM
|
You can also obtain a PDF version of this. |