Python Lists: Medical Insurance Project

Hi, I came back to this exercise after completing the loops module. i’m wondering if this can be solved by nested loops i’m sure it can but i’m unable to get the right solution using nested loops.

someone please go through my code and point out the mistakes and may be proper solution using nested loops. Appreciated


Found the answer guys, after browsing through the python looping techniques documentation… its really simple than i imagined…
Here’s the solution, just zip the both lists in for loop and then calculated the difference.


Here’s a way to do it without using a function, if you’re so inclined


Here’s another way if it helps.

for i in range(len(estimated_insurance_data)):
    insurance_cost_difference.append(estimated_insurance_data[i][-1] - insurance_data[i][-1])