In some ranking people collects points. The challenge is sort by points and calulate position for every person. But remember if two or more persons have same number of points, they should have same position number and sorted by name (name is unique).

For example:
Input structure:

Output should be:

Source: codewars | Difficulty: EASY

Starter code: def ranking(people):
	

Solutions:
def ranking(a):
	a.sort(key=lambda x: (-x['points'], x['name']))
	for (i, x) in enumerate(a):
		x['position'] = i + 1 if not i or x['points'] < a[i - 1]['points'] else a[i - 1]['position']
	return a


def ranking(people):
	people = people[:]
	people.sort(key=lambda person: (-person['points'], person['name']))
	for (i, person) in enumerate(people):
		if i and person['points'] == people[i - 1]['points']:
			person['position'] = people[i - 1]['position']
		else:
			person['position'] = i + 1
	return people


def ranking(people):
	S = sorted((d['points'] for d in people))[::-1]
	return [{**d, **{'position': S.index(d['points']) + 1}} for d in sorted(people, key=lambda k: (-k['points'], k['name']))]


def ranking(people):
	x = sorted(sorted(people, key=lambda i: i['name']), key=lambda i: i['points'], reverse=True)
	for i in range(len(x)):
		x[i]['position'] = i + 1
		if i > 0:
			if x[i - 1]['points'] == x[i]['points']:
				x[i]['position'] = x[i - 1]['position']
	return x


def ranking(people):
	ranked = sorted(people, key=lambda p: (-p['points'], p['name']))
	scores = [p['points'] for p in ranked]
	for p in ranked:
		p['position'] = 1 + scores.index(p['points'])
	return ranked


def ranking(people):
	temp_result = sorted([item for item in people], key=lambda x: (-x['points'], x['name']))
	for (idx, item) in enumerate(temp_result):
		if idx and item['points'] == temp_result[idx - 1]['points']:
			item['position'] = temp_result[idx - 1]['position']
		else:
			item['position'] = idx + 1
	return temp_result


from itertools import groupby

def ranking(people):
	x = len(str(len(people)))
	rank = 1
	people = sorted(people, key=lambda p: p['points'], reverse=True)
	groups = [[*g[1]] for g in groupby(people, key=lambda p: p['points'])]
	for g in groups:
		for p in g:
			p['position'] = rank
		rank += len(g)
	return sorted(people, key=lambda p: str(p['position']).zfill(x) + p['name'])


def ranking(people):
	new = sorted(people, key=lambda x: (-x['points'], x['name']))
	for i in new:
		i['position'] = new.index(i) + 1
	for (i, v) in enumerate(new):
		if i == 0:
			continue
		if v['points'] == new[i - 1]['points']:
			v['position'] = new[i - 1]['position']
	return new


ranking = lambda p: p.sort(key=lambda e: (-e['points'], e['name'])) or [e.update({'position': [x['points'] for x in p].index(e['points']) + 1}) or e for e in p]


def ranking(people):
	pnt = None
	res = []
	for (c, d) in enumerate(sorted(people, key=lambda d: (-d['points'], d['name'])), 1):
		if pnt != d['points']:
			pnt = d['points']
			pos = c
		res.append(dict({'position': pos}, **d))
	return res