I have a list:
ids = ["a", "b", "c", "a", "a", "d", "c"]
I need to create a function which will count duplicates in this list and mark them so that i get this list as a result:
['a', 'b', 'c', 'a_1', 'a_2', 'd', 'c_1']
How to do that? I tried to use list.count method but it doesnt help in this case:
b=[]
for i in ids:
b.append(i+str(ids.count(i)))
because i get this as a result:
['a3', 'b1', 'c2', 'a3', 'a3', 'd1', 'c2']