Answers for "count duplicate numbers python"

8

count the duplicates in a list in python

some_list=['a','b','c','b','d','m','n','n']

 my_list=sorted(some_list)
 
duplicates=[]
for i in my_list:
     if my_list.count(i)>1:
         if i not in duplicates:
             duplicates.append(i)
 
print(duplicates)
Posted by: Guest on January-30-2021
1

count number of repeats in list python

mylist.count(element)
Posted by: Guest on May-25-2020

Code answers related to "count duplicate numbers python"

Python Answers by Framework

Browse Popular Code Answers by Language