def counter_mine(ulist): result = {} for value in ulist: if result.get(value)==None: result[value]=1 else: result[value]+=1 return counter_mine if __name__ == '__main__': counter_mine(data)