Question: python, dont import modules def add_data(data, country, name, city, income, spend): This function accepts data with a name and information. if the name or country

python, dont import modules

def add_data(data, country, name, city, income, spend):

This function accepts data with a name and information. if the name or country is already in the data, it updates the information, else it adds new data for the name and country. This function returns a dictionary formatted like the ones below. The data is a dictionary with keys as countries and values are lists of the name data. Income must be positive to be in a state. Lists must not be empty. Names in the same country are to be put in alphabetical order. -- use insert when adding to the list

data =

US,James,Detroit,58029,4780 US,John,Richmond,729547,4832

def add_data(data, US, Lores, Potsman, 97699, 6890):

= {'US':[('James', 'Detroit', 58029, 4780),('John', 'Richmond', 729547, 4832), ('Lores', 'Potsman', 97699, 6890)]}

--------------------------------------------------------

data =

US,James,Detroit,58029,4780 US,John,Richmond,729547,4832

Spain, Lores, Potsman, 97699, 6890

def add_data(data, Spain, Lores, Potsman, 99999, 99999):

= {'Spain':[('Lores', 'Potsman', 99999, 99999)]}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!