Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
defaultdict(set) solution in Clear category for Switch Keys to Values by Phil15
from collections import defaultdict
def switch_dict(data):
result = defaultdict(set)
for key, value in data.items():
result[value].add(key)
return result
Sept. 19, 2022
Comments: