-
Notifications
You must be signed in to change notification settings - Fork 0
/
listcomps&loops.py
26 lines (21 loc) · 1001 Bytes
/
listcomps&loops.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
names = ["Judith", "Abel", "Tyson", "Martha", "Beverley", "David", "Anabel"]
estimated_insurance_costs = [1000.0, 2000.0, 3000.0, 4000.0, 5000.0, 6000.0, 7000.0]
actual_insurance_costs = [1100.0, 2200.0, 3300.0, 4400.0, 5500.0, 6600.0, 7700.0]
# Add your code here
total_cost = 0
for cost in actual_insurance_costs:
total_cost += cost
average_cost = total_cost/len(actual_insurance_costs)
print("Average Insurance Cost:", average_cost, "dollars.")
for i in range(len(names)):
name = names[i]
insurance_cost = actual_insurance_costs[i]
print("The insurance cost for", name, "is", insurance_cost, "dollars")
if insurance_cost > average_cost:
print("The insurance cost for", name, "is above average.")
elif insurance_cost < average_cost:
print("The insurance cost for", name, "is below average.")
else:
print("The insurance cost for", name, "is equal to the average.")
updated_estimated_costs = [e * 11/10 for e in estimated_insurance_costs]
print(updated_estimated_costs)