Please conduct a python program that satisfies the following…
Question Answered step-by-step Please conduct a python program that satisfies the following… Please conduct a python program that satisfies the following instruction. In this coding challenge, you will be writing two helper functions (Parts 1 and 2) and a final main function (Part 3) in order to find the states that belong to a particular Covid zone (categorized based on severity of outbreak). Let’s get started. Part 1:You are a CDC employee and have been tasked with tracking the number of Covid cases per state. States have sent you reports of the number of cases they’ve seen; however, because of the variety of testing clinics and healthcare providers, some states have sent in multiple reports that should be added together to get the true amount of Covid cases for that state. Your job is to take a list of tuples where each tuple is a pairing of (state, # of cases) and return a dictionary where each key is a state name and the value is a total number of cases reported in the input list.Function Name : cases_per_stateParameter : cases – A list where each element is a tuple, representing a state’s name and the number of cases reported for that stateReturn : A dictionary where the keys are states and the values are the number of cases reported by that stateExample Result:Input: cases = [(‘Texas’, 400), (‘Florida’, 500), (‘California’, 1000), (‘Florida’, 300), (‘California’, 400), (‘New York’, 200), (‘Arkansas’, 200), (‘Maine’, 100), (‘New York’, 100)]Output:{‘Texas’: 400, ‘Florida’: 800, ‘California’: 1400, ‘New York’: 300, ‘Arkansas’: 200, ‘Maine’: 100}Explanation: Florida is present in two tuples as (‘Florida’, 500) and (‘Florida’, 300). In the resulting dictionary, ‘Florida’ is the key, and the value is the sum of 500 and 300. The same applies for California and New York. Part 2:Now that you have a mapping of the number of cases corresponding to each state, you need to cluster these states based on their number of cases into ‘Red’, ‘Yellow’ and ‘Green’ zones. These zones determine the severity of Covid outbreak. Assume that you are given a lower limit and upper limit on the number of cases to determine the outbreak. Your job is to cluster the given states according to the following criteria:Green cluster – States with total number of cases less than or equal to the lower limitYellow cluster – States with total number of cases greater than the lower limit but less than the upper limitRed cluster – States with total number of cases greater than or equal to the upper limitFunction Name : categorize_statesParameters:cases – A dictionary with state names as keys and the number of COVID cases per 100,000 residents as valueslower – An integer that represents the lower threshold of cases per 100,000 residentsupper – An integer that represents the upper threshold of cases per 100,000 residentsReturn: A dictionary consisting of ‘Red’, ‘Yellow’ and ‘Green’ as keys and the corresponding values as the list of states falling into the specific cluster based on the number of cases.Example Result:Input: cases = {‘Texas’: 2337, ‘Florida’: 3925, ‘Illinois’: 1130, ‘California’: 1012, ‘Washington’: 2420, ‘New York’: 4100} lower = 2000 upper = 3000Output:{‘Red’: [‘Florida’, ‘New York’], ‘Yellow’: [‘Texas’, ‘Washington’], ‘Green’: [‘Illinois’, ‘California’]}Explanation: The ‘Florida’ and ‘New York’ keys in the dictionary cases have their values as 3925 and 4100 respectively which is greater than upper (3000). So, they fall into the ‘Red’ zone; thus, for the key ‘Red’, the value is a list containing [‘Florida’,’New York’]. Part 3:Now that you have the above helper functions for data cleaning and data clustering, you must use these helper functions to find the states that belong to a particular zone.In this function, you will be making function calls to cases_per_state and categorize_states totrack the number of cases per statefind the states that fall under each zone based on the number of casesFinally, the list of states pertaining to the input zone would be returned.NOTE: If you do not use the helper functions you wrote in part 1 and part 2, then you will NOT receive full credits for this problem!Function: query_statesParameters:cases – A list where each element is a tuple representing a state’s name and the number of cases reported for that statezone – One of either ‘Red’, ‘Yellow’, or ‘Green’ to indicate which category of states to returnlower – An integer that represents the lower threshold of cases per 100,000 residentsupper – An integer that represents the upper threshold of cases per 100,000 residentsReturn: A list of states in the corresponding zone based on the number of Covid cases in that stateExample Result:Input:cases = [(‘Texas’, 400), (‘Florida’, 500), (‘California’, 1000), (‘Florida’, 300), (‘California’, 400), (‘New York’, 200), (‘Arkansas’, 200), (‘Maine’, 100), (‘New York’, 100)] zone = “Green”lower = 250 upper = 750Output:[‘Arkansas’, ‘Maine’]Explanation: Arkansas and Maine are the only two states which would be in the ‘Green’ zone since they have less than 250 cases per 100,000 residents. Texas has 400, California has 1400, Florida has 800, and New York has 300. *You will not receive full credit for this coding challenge if the query_states functions doesn’t call the helper functions (cases_per_state and categorize_states).* Computer Science Engineering & Technology Python Programming CSE 8a Share QuestionEmailCopy link Comments (0)


