Try this:
def check(list_):
last = None
for element in list_:
if element == last:
return True
else:
last = element
return False
solved Check if there is a number near the same number in a list – python [duplicate]