Question: dict_contains_keys(items:set, example_dict:dict)->bool This function will have two parameters. The first is a set of numbers known as Number Set. The second is a dictionary known
dict_contains_keys(items:set, example_dict:dict)->bool
This function will have two parameters. The first is a set of numbers known as Number Set. The second is a dictionary known as Dictionary. Dictionary will have keys as integers and values as letters. The functions should return true if at least one of the numbers in the Number set is a key in Dictionary. It should return false otherwise.
Example:
Items: {8, 9, 5, 1}
Example: {6: 'i', 5: 'Y', 1: 'N', 0: 'E'}
Expected: True
Items: {9, 10, 4}
Example: {5: 'i', 3: 'o', 1: 'N'}
Expected: False
This is waht I have for now
items = {8, 9, 5, 1} example_dict = {6: 'i', 5: 'Y', 1: 'N', 0: 'E'} for i in items: getValues = example_dict.get(i) if getValues.isalpha(): True else: False ------------------------------------------------------------------------------------------------
concatenate_dict(dict_list:list)->dict
This function will be given a single parameter known as the Dictionary List. Your job is to combine all the dictionariesfound in the dictionary list into a single dictionary and return it. There are two rules for adding values to thedictionary:
- You must add key-value pairs to the dictionary in the same order they are found in the Dictionary List.
- If the key already exists, it cannot be overwritten. In other words, if two or more dictionaries have the same key, the key to be added cannot be overwritten by the subsequent dictionaries.
Example:
Dictionary List: [{'Z': 6, 'k': 10, 'w': 3, 'I': 8, 'Y': 5}, {'Y': 1, 'Z': 4}, {'X': 2, 'L': 5}]
Expected: {'Z': 6, 'k': 10, 'w': 3, 'I': 8, 'Y': 5, 'X': 2, 'L': 5}
Dictionary List: [{'z': 0}, {'z': 7}]
Expected: {'z': 0}
Dictionary List: [{'b': 7, 'b': 10, 'A': 8, 'Z': 2, 'V': 1}]
Expected: {'b': 7, 'A': 8, 'Z': 2, 'V': 1}
------------------------------------------------------------------------------------------------
Thank you so much!!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
