write python loop that checks a list for duplicates code example
Example 1: python has duplicates
def has_duplicates(lst):
return len(lst) != len(set(lst))
x = [1,2,3,4,5,5]
has_duplicates(x) # True
Example 2: python check for duplicate
def checkDuplicate(user):
if len(set(user)) < len(user):
return True
return False