Question: Work Area Results Instructions Given a dictionary d and a list ist, remove all elements from the dictionary whose key is an element of lst.

 Work Area Results Instructions Given a dictionary d and a list

Work Area Results Instructions Given a dictionary d and a list ist, 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. Instructor Notes: CORRECTION: Do not assume that all the entries in the List lst are keys in the Dictionary d # Submit History: * (7 of 7) 03/13/21 11:24:02 not_found=set() 2. for x in 1st: if x not in d. keys(): 4 not_found.add(x) 5 else: 6 del d[x] 7

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!