Home / Expert Answers / Computer Science / 1-given-a-dictionary-d-and-a-list-lst-remove-all-elements-from-the-dictionary-whose-key-is-an-elem-pa661

(Solved): 1.)Given a dictionary d and a list lst, remove all elements from the dictionary whose key is an elem ...



1.)Given a dictionary d and a list lst, remove all elements from the dictionary whose key is an element of lst. For example, given the dictionary {1:2, 3:4, 5:6, 7:8} and the list [1, 7], the resulting dictionary would be {3:4, 5:6}. Assume every element of the list is a key in the dictionary. 

2.)Given dictionaries, d1 and d2, create a new dictionary with the following property: for each entry (a, b) in d1, if a is not a key of d2 (i.e., not a in d2) then add (a,b) to the new dictionary for each entry (a, b) in d2, if a is not a key of d1 (i.e., not a in d1) then add (a,b) to the new dictionary For example, if d1 is {2:3, 8:19, 6:4, 5:12} and d2 is {2:5, 4:3, 3:9}, then the new dictionary should be {8:19, 6:4, 5:12, 4:3, 3:9} Associate the new dictionary with the variable d3 

3.)Given the dictionary, d, find the largest key in the dictionary and associate the corresponding value with the variable val_of_max. For example, given the dictionary {5:3, 4:1, 12:2}, 2 would be associated with val_of_max. Assume d is not empty.

 

in python and if possible according to Pearson my programming lab

 



We have an Answer from Expert

View Expert Answer

Expert Answer


YOUR ANSWER IS AS FOLLOWS:- A LIKE FROM YOUR SIDE IS HIGHLY APPRECIABLE >>> Q3) A3) THE CODE IS AS FOLLOWS:- d = {5: 3, 4: 1, 12: 2} val_of_max = d[max(d.keys())] print(val_of_max) OUTPUT
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe