Given an array (or list) of scores, return the array of _ranks_ for each value in the array.  The largest value has rank 1, the second largest value has rank 2, and so on. Ties should be handled by assigning the same rank to all tied values. For example:
    ranks([9,3,6,10]) = [2,4,3,1]
and
    ranks([3,3,3,3,3,5,1]) = [2,2,2,2,2,1,7]
because there is one 1st place value, a five-way tie for 2nd place, and one in 7th place.
from collections import Counter

def ranks(a):
    id, res = 1, {}
    for k,v in sorted(Counter(a).items(), reverse=True):
        id, res[k] = id+v, id
    return list(map(res.get, a))
from collections import Counter

def ranks(a):
    id, res = 1, {}
    for k,v in sorted(Counter(a).items(), reverse=True):
        id, res[k] = id+v, id
    return list(map(res.get, a))