Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created November 24, 2020 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/e161446f6213a94795e136edbeb594c3 to your computer and use it in GitHub Desktop.
Save codecademydev/e161446f6213a94795e136edbeb594c3 to your computer and use it in GitHub Desktop.
Codecademy export
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 insurance_cost in actual_insurance_costs:
total_cost += insurance_cost
average_cost = total_cost / len(actual_insurance_costs)
print("The Average Insurance Cost: " + str(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 " + str(insurance_cost) + " dollars.")
if insurance_cost > average_cost:
print(name + ", you're currenty spending " + str(insurance_cost - average_cost) + " dollars more than the average plan.")
elif insurance_cost < average_cost:
print(name + ", you're currenty spending " + str(average_cost - insurance_cost) + " dollars less than the average plan.")
else:
print(name + ", you are currently paying the same as the average insurance cost.")
updated_insurance_costs = [updated*(11/10) for updated in estimated_insurance_costs]
print(updated_insurance_costs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment