How do you print a dictionary in Python where if the value matches another value in the dictionary, they are printed on the same line?
Code:
result = {'light':4,'plane':4, 'vehicle':5}
print(result)
Current Output:
{'light': 4, 'plane': 4, 'vehicle': 5}
Expected Output:
4 light, plane
5 vehicle
How would you also count the frequency of the words as in the expected output? For example, light + plane
is 2
.