Lists in Python Practice - Preparation for Lab Assignment and
Mini Quiz
A certain medical insurance plan covers each medical procedure
according to the following rule:
insurance pays 75% after 15 dollars deductible. So, for each procedure,
the patient pays $15 plus the 25%
of the remaining cost.
For example, if the full cost of the procedure is 120 dollars, then
patient pays 15 + 25*(120-15)/100 = 41.25 dollars
insurance pays (120-15)*75/100 = 78.75 (which is 120-41.25)
Write a program that reads a number of the procedures done in one
year. The program randomly
generates the cost for each procedure and store all costs in the list.
The program then calculates the patient portion and the insurance portion
for each procedure. The results
are stored in two separate lists. The program also finds the
average amount patient paid for procedure and the total amount patient
paid per year for all procedures,
and the average amount insurance paid for procedure and the total amount
insurance paid per year.
Design:
- make_list(size, min_limit, max_limit)
- process(my_list) - that has ONE paremeter - list of procedure
costs. The
function creates amd returns TWO new lists: list of patient portions
and list of insurance portions
- sum_average(my_list) - written for you, this function returns sum
and average
- main - partially written: reads a number of medical procedures
per year, generates a list of
procedure costs, calls function process to find patient portion and
insurance portion and prints the
results.
The program also finds the
average amount patient paid for procedure and the total amount patient
paid per year, and the average
amount insurance paid for procedure and the total amount insurance paid
per year.
Example:
size 4, procedure_cost=[15, 50, 70, 156]
partient=[15, 23.75, 28.75, 50.25]
insurance=[0, 26.25, 41.25, 105.75]
average_patient=29.44
average_insurance=43.31
total_patient=117.75
total_insurance=173.25