def indices(lst, item): return [i for i, x in enumerate(lst) if x == item] temp_list=[] for x in data: temp_list.append(x[0]) print(len(temp_list)) for i in range(0,len(temp_list)): temp=indices(temp_list,temp_list[i]) if len(temp)>=2: cc=65 for k in temp: ad=chr(cc) temp_list[k]=temp_list[k]+'-'+ad cc+=1 for j in range(0,len(data)): data[j][0]=temp_list[j] print(data)