Karl P. answered 07/30/20
Oracle Certified Computer Science Expert (1000+ hour tutor experience)
def removeDictItem(mydict, key):
if (key in mydict):
mydict.pop(key)
return mydict
print(removeDictItem({'tomato': 'red', 'banana' : 'yellow', 'lime': 'green'}, 'banana'))
You should check if the key exists inside the dictionary, and then remove it by taking the key inside the pop method and after that, return the dictionary.