Dec-15-2018, 05:17 PM
Good afternoon, I'm stuck because I do not know how to tackle the next task, someone could give me a hand on how to approach it
thank you
issue
If we have a dictionary that contains as keys the name of a person and as a value a list with their "personal preferences" that can be, for example "swim", "read", "go to the movies", etc. You want to program a function AddPreference (dictionary, person, preference) such that:
o If the person does not exist, add it to the dictionary with a list that contains only one element.
o If the person exists and the current preference exists on your list, it has no effect, but if that preference does not exist on your list, add it to the list.
Once the above is completed, make a program that adds information to the dictionary and once it has that information included, ask the user for a preference by keyboard and list on the screen the name of all the people who have that preference.
thank you
issue
If we have a dictionary that contains as keys the name of a person and as a value a list with their "personal preferences" that can be, for example "swim", "read", "go to the movies", etc. You want to program a function AddPreference (dictionary, person, preference) such that:
o If the person does not exist, add it to the dictionary with a list that contains only one element.
o If the person exists and the current preference exists on your list, it has no effect, but if that preference does not exist on your list, add it to the list.
Once the above is completed, make a program that adds information to the dictionary and once it has that information included, ask the user for a preference by keyboard and list on the screen the name of all the people who have that preference.