human
Construction of Longest Increasing Subsequence ( LIS ) and printing LIS sequence | Utility function to print LIS.
Function to construct and print Longest Increasing Subsequence.
L [ i ] - The longest increasing sub - sequence ends with arr [ i ].
L [ 0 ] is equal to arr [ 0 ].
start from index 1.
do for every j less than i.
L [ i ] = { Max ( L [ j ] ) } + arr [ i ] where j < i and arr [ j ] < arr [ i ].
L [ i ] ends with arr [ i ].
L [ i ] now stores increasing sub - sequence of arr [ 0. . i ] that ends with arr [ i ].
LIS will be max of all increasing sub - sequences of arr.
max will contain LIS.
Driver Code.
construct and print LIS of arr"
How can the above be solved in Python?

=====
Give me a code to construction of Longest Increasing Subsequence ( LIS ) and printing LIS sequence and the other steps required?
assistant
#Here is code to construction of Longest Increasing Subsequence ( LIS ) and printing LIS sequence and the other steps required.
 def printLIS ( arr : list ) :
	for x in arr :
		print ( x , end = " ▁ " )
	print ( )
def constructPrintLIS ( arr : list , n : int ) :
	l = [ [ ] for i in range ( n ) ]
	l [ 0 ] . append ( arr [ 0 ] )
	for i in range ( 1 , n ) :
		for j in range ( i ) :
			if arr [ i ] > arr [ j ] and ( len ( l [ i ] ) < len ( l [ j ] ) + 1 ) :
				l [ i ] = l [ j ] . copy ( )
		l [ i ] . append ( arr [ i ] )
	maxx = l [ 0 ]
	for x in l :
		if len ( x ) > len ( maxx ) :
			maxx = x
	printLIS ( maxx )
if __name__ == " _ _ main _ _ " :
	arr = [ 3 , 2 , 6 , 4 , 5 , 1 ]
	n = len ( arr )
	constructPrintLIS ( arr , n )