With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!
from collections import Counter from string import ascii_uppercase as letters def gen(L): c = Counter(L) for elt, count in c.items(): if count == 1: yield elt else: for letter in letters[:count]: yield elt + letter
>>> L = ['T1','T2','T2','T2','T2','T3','T3'] >>> list(gen(L)) ['T2A', 'T2B', 'T2C', 'T2D', 'T3A', 'T3B', 'T1']
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.