I want to create a list from an existing list after removing all duplicates. Program works if I use a "for loop" but nothing happens if I use a list comprehension.
#use for loop
l=[1,2,2,3,1,1,2]
j=[]
for i in l:
if i not in j:
j.append(i)
print l
print j
#using list
l1=[1,2,2,3,1,1,2]
j1=[]
j1=[i for i in l1 if i not in j1]
print l1
print j1