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
2# ----- Create a list with no repeating elements ------ #
3
4mylist = [67, 7, 89, 7, 2, 7]
5newlist = []
6
7 for i in mylist:
8 if i not in newlist:
9 newlist.append(i)
10
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'''