I have a nested list which contains different objects, they're duplicate pairs of objects in the nested list and i'm trying to remove them but i keep getting a
TypeError: unorderable types: practice() < practice()
I know this error is caused by me trying to work with objects rather than integers but i don't know how else to remove the duplicates here is what i tried
class practice:
id = None
def __init__(self,id):
self.id = id
a = practice('a')
b = practice('b')
c = practice('c')
d = practice('d')
e = practice('e')
f = practice('f')
x = [[a,b],[c,d],[a,b],[e,f],[a,b]]
unique_list = list()
for item in x:
if sorted(item) not in unique_list:
unique_list.append(sorted(item))
print(unique_list)
keytosortedshould work.