Hi,
I am trying to figure out how to update a dictionary. Specifically, I am trying to figure out #19 in the medical insurance project (https://www.codecademy.com/paths/data-science/tracks/dscp-python-fundamentals/modules/dscp-python-dictionaries/projects/ds-python-dictionaries-project)
#19 wants you to write a function that will take the name and the person’s medical record into the medical records dictionary.
The medical records need to have the following form:
{'Marina': {'Age': 27, 'Sex': 'Female', 'BMI': 31.1, 'Children': 2, 'Smoker': 'Non-smoker', 'Insurance_cost': 6607.0}, 'Vinay': {'Age': 24, 'Sex': 'Male', 'BMI': 26.9, 'Children': 0, 'Smoker': 'Non-smoker', 'Insurance_cost': 3225.0}, ...}
I have tried writing the following but only received a syntax error but nothing else.
def update_medical_records(name, age, sex, bmi, children smoker, insurance_cost):
medical_records_dict[name] = {"Age": age, "Sex": sex, "BMI": bmi, "Children": children, "Smoker": smoker, "Insurance_cost": insurance_cost}
medical_records.update(medical_records_dict)
Any ideas why this function won’t work?
Thank you so much for helping!