human
Binary String of given length that without a palindrome of size 3 | Python3 program find a binary String of given length that doesn 't contain a palindrome of size 3..
Printing the character according to i.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to binary String of given length that without a palindrome of size 3 and the other steps required.
 def generateString ( n ) :
	s = " " ;
	for i in range ( n ) :
		if ( ( i & 2 ) > 1 ) :
			s += ' b ' ;
		else :
			s += ' a ' ;
	print ( s ) ;
if __name__ == ' _ _ main _ _ ' :
	n = 5 ;
	generateString ( n ) ;
	n = 8 ;
	generateString ( n ) ;
	n = 10 ;
	generateString ( n ) ;