Question: Help me with this pls (python) Modify and return the given dictionary as follows: if the keys a and b have values that have different

Help me with this pls (python) Modify and return the given dictionary as follows: if the keys "a" and "b" have values that have different lengths, then set "c" to have the longer value. If the values exist and have the same length, change them both to the empty string in the dictionary.

INPUTS /OUTPUTS: ({"a": "aaa", "b": "bb", "c": "cake"}) {"a": "aaa", "b": "bb", "c": "aaa"}

({"a": "aa", "b": "bbb", "c": "cake"}) {"a": "aa", "b": "bbb", "c": "bbb"}

({"a": "aa", "b": "bbb"}) {"a": "aa", "b": "bbb", "c": "bbb"}

def problem_nine(dictionary):

#note i need return

return dictionary

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!