1mylist = ["a", "b", "b", "c", "a"]
2mylist = sorted(set(mylist))
3print(mylist)
1
2 mylist = ["a", "b", "a", "c", "c"]
3mylist = list(dict.fromkeys(mylist))
4
5 print(mylist)
1# remove duplicate from given_list using list comprehension
2res = []
3[res.append(x) for x in given_list if x not in res]
1''' we can convert the list to set and then back to list'''
2a=[1,1,2,3,4,5,6,6,7]
3'''b=(list(set(a))) # will have only unique elemenets'''
1# get unique items in list aa with order maintained (python 3.7 and up)
2list(dict.fromkeys(aa))