I was working on step 7 of the Python Lists: Medical Insurance Estimation Project.
Here are the instructions:
We want to add our estimated insurance data for Maria, Rohan, and Valentina to the
.append() to add
("Maria", maria_insurance_cost) to
estimated_insurance_data. Do the same for Rohan and Valentina.
here’s is the code I entered:
it gave me the following error:
Traceback (most recent call last):
File “script.py”, line 24, in
TypeError: append() takes exactly one argument (2 given)
eventually I looked at the hint and basically showed a double parenthesis (see code below from the hint)
estimated_insurance_data.append(("Maria", maria_insurance_cost)) estimated_insurance_data.append(("Rohan", rohan_insurance_cost)) estimated_insurance_data.append(("Valentina", valentina_insurance_cost))`
I was able to get to work with the double parenthesis. But I don’t understand why it worked. Can anyone explain why the double parenthesis worked and what other situations I will need to use double parenthesis? I’m a very rule driven person and I have a hard time understanding concepts with rules.