I've been deleting all occurrences unintentionally. I would like to keep at least one set of occurrences.
For example, I have [[1,2,3],[1,3,2],[4,5,6],[5,6,4]]
and the desired output would be akin to [[1,2,3],[4,5,6]]
.
s = 1,2,3,4,5,6
c = [[1,2,3],[4,5,6],[4,6,5]]
remove_sets = []
for a in range(0, len(c)):
for b in permutations(c[a], 3):
# my idea is that if list(b) != c[a]
# it should not delete all occurences.
if list(b) != c[a]:
if list(b) in c:
remove_sets.append(list(b))
# delete those occurences.
for cc in range(0, len(remove_sets)):
if remove_sets[cc] in c:
del c[c.index(remove_sets[cc])]
Unintended Result/Output
[[1,2,3]]
My desired output would be
[[1,2,3],[4,5,6]]
Question
Is there a function for removing these duplicate sets where order is switched around?