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 suic
from collections import defaultdict
def switch_dict(data: dict) -> dict:
d = defaultdict(set)
for k, v in data.items():
d[v].add(k)
return d
Oct. 21, 2022
Comments: