I have finished this module and my code was successful, but I wanted to make the calculations for the difference (one of the extra exercises at the end) smaller, so I added the calculations to the creation of a list but it doesn’t like the Syntax, and I cannot understand why.
Originally, I had the following line for each person:
maria_dif = maria_insurance_cost - insurance_cost[0]
I did this for each person, referencing the position in the insurance_cost list where I knew their information resided. These four variables were added to a list called insurance_difference and then printed out as below:
insurance_difference = [maria_dif, rohan_dif, valentina_dif, akira_dif]
insurance_cost_difference = (list(zip(names, insurance_difference)))
print(insurance_cost_difference)
I then tried to combine it all together in a single statement and it returned a SyntaxError:
insurance_difference = [(maria_dif = maria_insurance_cost - insurance_costs[0]), (rohan_dif = rohan_insurance_cost - insurance_costs[1]), (valentina_dif = valentina_insurance_cost - insurance_costs[2]),
(akira_dif = akira_insurance_cost - insurance_costs[3])]
What have I missed? I thought you could do the calculations inside the code for the insurance_difference list.