======================================================================================================================================================================================================================== # Reverse the key-values in a dictionary and return a new dictionary # Assume all values in dict are unique def reverse_dictionary(dict): retVal = {} keys = list(dict.keys()) for i in range(len(keys)):# for each key in input k = keys[i] # key v = dict[k] # value if (v not in retVal): retVal[v] = k else: print('key exists. not doing anything.') pass return retVal