def sortByValue(d):
 items = d.items()
 backitems = [[v[1], v[0]] for v in items]
 backitems.sort()
 backitems.reverse()
 return [backitems[i][1] for i in range(0, len(backitems))]

def sortByValue ( d ) : items = d . items ( ) backitems = [ [ v [ 1 ] , v [ 0 ] ] for v in items ] backitems . sort ( ) backitems . reverse ( ) return [ backitems [ i ] [ 1 ] for i in range ( 0 , len ( backitems ) ) ]
returns the keys of dictionary d sorted by their values .