In [1]:
def has_duplicates(seq):
    return len(seq) != len(set(seq))

In [2]:
l = [0, 1, 2]
print(has_duplicates(l))


False

In [3]:
l = [0, 1, 1, 2]
print(has_duplicates(l))


True

In [4]:
l_2d = [[0, 1], [1, 1], [0, 1], [1, 0]]
# print(has_duplicates(l_2d))
# TypeError: unhashable type: 'list'

In [5]:
def has_duplicates2(seq):
    seen = []
    unique_list = [x for x in seq if x not in seen and not seen.append(x)]
    return len(seq) != len(unique_list)

In [6]:
l_2d = [[0, 0], [0, 1], [1, 1], [1, 0]]
print(has_duplicates2(l_2d))


False

In [7]:
l_2d = [[0, 0], [0, 1], [1, 1], [1, 1]]
print(has_duplicates2(l_2d))


True

In [8]:
l = [0, 1, 2]
print(has_duplicates2(l))


False

In [9]:
l = [0, 1, 1, 2]
print(has_duplicates2(l))


True

In [10]:
l_2d = [[0, 1], [2, 3]]
print(sum(l_2d, []))


[0, 1, 2, 3]

In [11]:
print(has_duplicates(sum(l_2d, [])))


False

In [12]:
l_2d = [[0, 1], [2, 0]]
print(has_duplicates(sum(l_2d, [])))


True