Вы можете попробовать что-то вроде этого
mylist = [
['f', 3], ['a', 2], ['d', 2], ['f', 4], ['b', 2], ['a', 2], ['f', 3], ['f', 3],
['e', 1], ['b', 2], ['e', 1], ['c', 1], ['a', 3], ['d', 3], ['f', 1], ['f', 4],
['b', 4], ['b', 1], ['c', 4], ['d', 1], ['a', 3], ['e', 1], ['b', 2], ['c', 3],
['d', 3], ['c', 2], ['c', 1], ['a', 2], ['d', 4], ['b', 4], ['g', 2]
]
Вы можете использовать set для хранения уникальных элементов из вложенного списка
unique_items = set(i[0] for i in fixed_game_b0_1)
# {'e', 'a', 'b', 'd', 'c', 'g', 'f'}
token_winner = [0, 0, 0, 0] # 1, 2, 3, 4
Затем вы можете перебирать список от последнего к первому чтобы найти последнее вхождение и разбить l oop, как только вы найдете все вхождения уникальных букв
for i in range(-1, -len(mylist)-1, -1):
if mylist[i][0] not in unique_items:
continue
# moves the control back to the top of the loop. if the char is already found one
token_winner[mylist[i][1] - 1] = token_winner[mylist[i][1] -1] + 1
unique_items.remove(mylist[i][0])
if len(unique_items) < 1:
break
# output==> token_winner [2, 2, 0, 3]