Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Switch Keys to Values by eugene100372
from collections import defaultdict
def switch_dict(data: dict) -> dict:
res=defaultdict(set)
for key in data: res[data[key]].add(key)
return res
Oct. 21, 2022