def keywithmaxval(d):
    """ a) create a list of the dict's keys and values; 
         b) return the key with the max value"""
v = list(d.values())
k = list(d.keys())
return k[v.index(max(v))]
Getting key with maximum value in dictionary?