Способ 1:
import collections
res = list(map(lambda x: tuple(collections.Counter(x).items()), text))
покороче
import collections
res = [*map(lambda x: tuple(collections.Counter(x).items()), text)]
еще покороче
import collections
res = [tuple(collections.Counter(x).items()) for x in text]
и ещё
import collections
res = [(*collections.Counter(x).items(),) for x in text]
и в 1 строчку
res = [(*__import('collections').Counter(x).items(),) for x in text]
Способ 2 (без внешних библиотек):
сразу вариант покороче:
res = [tuple((l, x.count(l)) for i, l in enumerate(x) if l not in x[:i]) for x in text]
ну или подлиннее, но без if
:
res = [tuple((l, x.count(l)) for l in sorted(set(x), key=lambda m: x.index(m))) for x in text]
или покороче, но для извращенцев:
res = [tuple((x[i], x.count(x[i])) for i in set(map(x.index, x))) for x in text]
Способ 3 (если порядок букв не важен):
res = [tuple((l, x.count(l)) for l in set(x)) for x in text]
если хочется на 1 байтик поменьше сделать и вообще не использовать tuple
:
res = [(*((l, x.count(l)) for l in set(x)),) for x in text]
Способ 4 (с использованием моржа):
res = [(a := set(x), (*zip(a, map(x.count, a)),))[1] for x in text]