I tried the following code but it doesn't seem to remove any duplicates
list2 = [element for element in list1 if element not in list2]
however,
for i in list1:
if i not in list2:
list2.append(i)
this code works perfectly fine, can anyone please let me know why is this the case?