4 examples of 'python list unique' in Python

Every line of 'python list unique' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
7def unique1(lst):
8 outputList = []
9 for el in lst:
10 if el not in outputList:
11 outputList.append(el)
12 print(outputList)
15def unique2(lst):
16 myset=set(lst)
17 print(list(myset))
7def is_unique_list(seq):
8 for i in seq:
9 if seq.count(i) != 1:
10 return False
11 return True
15def unique(list1):
16 # init a null list
17 unique_list = []
18 # traverse for all elements
19 for x in list1:
20 # check if exists in unique_list or not
21 if x not in unique_list:
22 unique_list.append(x)
23 return unique_list

Related snippets