human
Write me a code to program to print all substrings of a given string and the other steps required given the following:
Program to print all substrings of a given string | Python program for the above approach.
outermost for loop this is for the selection of starting point.
2 nd for loop is for selection of ending point.
3 rd loop is for printing from starting point to ending point.
changing the line after printing from starting point to ending point.
Driver Code.
calling the method to print the substring"
How can the above be solved in Python?
assistant
#Here is code to program to print all substrings of a given string and the other steps required.
 def printSubstrings ( string , n ) :
	for i in range ( n ) :
		for j in range ( i , n ) :
			for k in range ( i , ( j + 1 ) ) :
				print ( string [ k ] , end = " " )
			print ( )
string = " abcd "
printSubstrings ( string , len ( string ) )