Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Switch Keys to Values by boojum
def switch_dict(data: dict[str, str]) -> dict[str, str]:
s_dict = {v: {k} for k, v in data.items()}
for k, v in data.items():
if v in s_dict:
s_dict[v].add(k)
return s_dict
April 15, 2023
Comments: