1def inverse_dict(my_dict):
2 """
3 the func get a dictinary and reverse it, the keys become values and the values become keys.
4 :param my_dict: the dictinary that need to be reversed.
5 :return: a VERY pretty dictionary.
6 """
7 result_dict = {}
8 for key, value in my_dict.items():
9 if not value in result_dict.keys():
10 result_dict[value] = []
11 result_dict[value].append(key)
12 return result_dict, print(result_dict)