human
Print string of odd length in ' X ' format | Function to print the given string in respective pattern.
Print characters at corresponding places satisfying the two conditions.
Print blank space at rest of places.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to print string of odd length in ' X ' format and the other steps required.
 def printPattern ( Str , Len ) :
	for i in range ( Len ) :
		for j in range ( Len ) :
			if ( ( i == j ) or ( i + j == Len - 1 ) ) :
				print ( Str [ j ] , end = " " )
			else :
				print ( " ▁ " , end = " " )
		print ( )
Str = " geeksforgeeks "
Len = len ( Str )
printPattern ( Str , Len )