I have a nested list like this e.g:
L = [[A,200][B,300][C,500][A,300]]
I would like to know if just the letters are duplicates not the numbers. I tried this but this would also tell me if the numbers were duplicates.
def find_duplicates(L):
for list in L:
for number in list:
print(max(Counter(sum(L, [])).values()) > 1)
I didnt know whether to flatten the list and then just iterate through a single list (but this would defeat the purpose of the nested list) or if there´s a way to check for the first index of each sublist. Can anyone let me know how can I do that?
Thank you!