I have list of lists looks like
a=[[1,2],[2,1],[2,3]]
I would like to check if the fırst elements of sublist are same, if they are same I would like to put them a new list.
I tried
for x in a:
for y in x:
if y in x:
I could not find what to write after that. My output is that new lists like
a1=[[2,3,1],[1,2]]
Thank you