repl.it
@anonymous/

HurtfulIncomparableBufeo

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
lista = [['segundo', 1], ['evidenciaram', 3],['Palavras', 4], ['apresentado', 2], ['tratados', 1], ['realizada', 1], ['mostraram', 2]]
l_sorted = sorted(lista, reverse=True, key=lambda x: x[1])

rank = 1
l_sorted[0].append(rank)
for i in range(len(l_sorted)-1):
    if(l_sorted[i][1] != l_sorted[i+1][1]):
        rank += 1
    l_sorted[i+1].append(rank)
print(l_sorted)