human
Print triplets with sum less than k | A Simple python 3 program to count triplets with sum smaller than a given value.
Fix the first element as A [ i ].
Fix the second element as A [ j ].
Now look for the third number.
Driver Code"
Solution in Python:

=====
Can you provide a code to print triplets with sum less than k and the other steps required?
assistant
#Here is code to print triplets with sum less than k and the other steps required.
 def printTriplets ( arr , n , sum ) :
	for i in range ( 0 , n - 2 , 1 ) :
		for j in range ( i + 1 , n - 1 , 1 ) :
			for k in range ( j + 1 , n , 1 ) :
				if ( arr [ i ] + arr [ j ] + arr [ k ] < sum ) :
					print ( arr [ i ] , " , " , arr [ j ] , " , " , arr [ k ] )
if __name__ == ' _ _ main _ _ ' :
	arr = [ 5 , 1 , 3 , 4 , 7 ]
	n = len ( arr )
	sum = 12
	printTriplets ( arr , n , sum )