human
Zygodrome Number | Function to check if N is an zygodrome number.
Convert N to string.
Adding a space at the beginning and end of the string.
Traverse the string.
If any character is not same as prev and next then return false.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to zygodrome Number and the other steps required.
 def iszygodromeNum ( N ) :
	s = str ( N ) ;
	s = ' ▁ ' + s + ' ▁ ' ;
	i = 1
	while i < len ( s ) - 1 :
		if ( ( s [ i ] != s [ i - 1 ] ) and ( s [ i ] != s [ i + 1 ] ) ) :
			return False ;
		i += 1
	return True ;
if __name__ == ' _ _ main _ _ ' :
	n = 1122 ;
	if iszygodromeNum ( n ) :
		print ( " Yes " )
	else :
		print ( " No " )