Answers for "find the duplicates strings of a python list"

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
0

python find duplicates in string

from collections import Counter

def do_find_duplicates(x):
    x =input("Enter a word = ")
    for key,val in Counter(x).items():
        print(key,val)
Posted by: Guest on April-17-2021

Code answers related to "find the duplicates strings of a python list"

Python Answers by Framework

Browse Popular Code Answers by Language