Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

duplicate in list

thelist = [1, 2, 3, 4, 4, 5, 5, 6, 1]
 
 
def dup(x):
    duplicate = []
    unique = []
    for i in x:
        if i in unique:
            duplicate.append(i)
        else:
            unique.append(i)
    print("Duplicate values: ", duplicate)
    print("Unique Values: ", unique)
 
 
dup(thelist)
Source by www.pythonprogramming.in #
 
PREVIOUS NEXT
Tagged: #duplicate #list
ADD COMMENT
Topic
Name
1+7 =