Question: python dictionaries help A Bookmark this page Coding Problem 4.5.4 (External resource) (B.0 points possible) ModityDict.py Submit Run Grades Reset urite a function called modify

python dictionaries help A Bookmark this page Coding Problem 4.5.4 (External resource)python dictionaries help

A Bookmark this page Coding Problem 4.5.4 (External resource) (B.0 points possible) ModityDict.py Submit Run Grades Reset urite a function called modify dict. modify_dict takes one rameter, a dictionary. The dictionary's keys are 3 #last names, and the dictionary's values are people's first 4 #names.For example, the key "Joyner" would have the value " 6# 7 #modify dict should delete any key-valuepair for , which the 8 key's first letter is not capitalized. For example, the 9 #key-value pair "joyner": "David" would be deleted, but the e #key-value pair "Joyner":"david" woul Then, 11 #return the modified dictionary 12 #Remember, the keyword del deletes items from lists and 13#dictionaries. For example, to remove the 14 #the dictionary my-dict, you would write: del my-dict["key!"] s #or, if the key was the variable my-key, you would write 16 #deI my-dict [my-key] 17 #Hint: If 18 # looping 19 #ue 5hould never change the number if items in a list or 29 #dictionary while looping through those items. Think about 21 #what you could do to keep track of which keys should be 22 #deleted so you can delete them after the loop is done 23 #Hint 2: To check if the first letter of a string is 24 #capital letter, use string[e].isupper() 25 #W 26 27 #Below are some lines of code that will 28 #You can change the v 29 #function with different inputs 38 #lf your function works correctly, this will originally 31 print (although the order of the keys may vary) ,2 | # (Diaddigo":"Joshua",..Elliott':'jackie') 33 my-dict {"Joshua': 'Diaddigo', .joyner':'David . , .Elliott':.jackie', .murrell. :"marguerite') 34 print (modify dict(my dict)) d not be deleted. key! from try to delete items from the dicti 11 run into while the dictionary, you rite your function here! test your function alue of the variable(s) to test your . Console output will be displayed here

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!