Question: Question no. 6: Complete the function, so that if you don't have a key return 999. [10 points) # Code goes here def get from(dictionary,
Question no. 6: Complete the function, so that if you don't have a key return 999. [10 points) # Code goes here def get from(dictionary, keys): values = ? #complete your code here return values #should return 999 if key doesn't exist print(getfrom(dictionary=d, keys='z')) Question no. 6: Complete the function, so that if you don't have a key return 999. (10 points) # Code goes here def getfrom(dictionary, keys): values = ? #complete your code here return values #should return 999 if key doesn't exist print(getfrom(dictionary=d, keys='z')) Question no. 7: Complete the function, so that if you don't have a key return 999 and add 999 to dictionary? (10 points) # Code goes here def get from(dictionary, keys): values = ? #complete your code here return values #should return 999 if key doesn't exist and should add to dictionary as well print(getfrom(dictionaryd, keysu'z')) # Now this shouldn't throw error as 'z' is now set to dictionary print(d['z'l)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
