Question: python language Function Name: security_clearance Parameters: a list of tuples ( list ) Returns: dictionary of organized security clearance information ( dict) Description: As computer

python language

python language Function Name: security_clearance Parameters: a list of tuples ( list) Returns: dictionary of organized security clearance information ( dict) Description: Ascomputer scientists, we should always keep security in mind. We don't want

Function Name: security_clearance Parameters: a list of tuples ( list ) Returns: dictionary of organized security clearance information ( dict) Description: As computer scientists, we should always keep security in mind. We don't want unauthorized users accessing restricted files. The higher-ups give you a list of security infor- mation for each personnel: [(kind, level, name), (kind, level, name), (kind, level, name) etc) Your mission is to organize this list so that all of those with the same kind and level are grouped together for easier look up. The higher-ups specify that the format must be: {kind1: { level1: [name2, name3, name6, etc.), level2: [namel, name4, etc.), kind2: { level2: [name7, name8, etc.] Test Cases >>> info = [("Party", 1, "Literally everyone"), ("Party", 2, "Who do you know h ere?"), ("Party", 3, "Brothers only")] >>> print (security_clearance(info)) {"Party" : {1 : ["Literally everyone"], 2: ["Who do you know here?"), 3: "Broth ers only"}} >>> info = [("Top Secret", 3, "Drake"), ("Confidential", 2, "Shawn Mendes"), (" Unclassified", 1, "Pusha T"), ("Top Secret", 3, "LeBron James"), ("Confidential ", 1, "Future"), ("Confidential", 1, "Arizona Zervas")] >>> print (security_clearance(info)) {"Top Secret" : {3: ["Drake", "LeBron James"]}, "Confidential" : {2: ["Shawn Me ndes"], 1 : ["Future", "Arizona Zervas"]}, "Unclassified" : {1 : ["Pusha T"]}}

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!