Python Find and Filter Duplicates from List || List || Python
In this we are going to see a basic program to find and filter duplicates from list in Python Programming Language.



def main():
    list1 = [10, 20, 30, 50, 60, 40, 30, 20, 10, 10, 20, 10]
    list2 = []
    print("Numbers repeated - count")
    for n in list1:
        if n not in list2:
            if list1.count(n) > 1:
                print(n, " - ", list1.count(n))
            list2.append(n)
    print("All elements of the list: ", list2)


main()

# Coded by Shreya Idate


#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post