generate functionTue, 07 Mar 2023

Check that the number has no consecutive identical digits

def is_consecutive(n): s = str(n) for i in range(len(s)-1): if s[i] == s[i+1]: return False return True is_consecutive(1234)

Questions about programming?Chat with your personal AI assistant