Answers for "check for duplicates in python"

3

python has duplicates

def has_duplicates(lst):
    return len(lst) != len(set(lst))
    
x = [1,2,3,4,5,5]
has_duplicates(x) 			# True
Posted by: Guest on February-16-2021
3

how to check if there are duplicates in a list python

>>> your_list = ['one', 'two', 'one']
>>> len(your_list) != len(set(your_list))
True
Posted by: Guest on December-12-2019
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 "check for duplicates in python"

Python Answers by Framework

Browse Popular Code Answers by Language