human
Can you provide a code to leaders in an array and the other steps required given the following:
Leaders in an array | Python function to print leaders in array.
Rightmost element is always leader.
Driver function"
How can the above be solved in Python?
assistant
#Here is code to leaders in an array and the other steps required.
 def printLeaders ( arr , size ) :
	max_from_right = arr [ size - 1 ]
	print max_from_right ,
	for i in range ( size - 2 , - 1 , - 1 ) :
		if max_from_right < arr [ i ] :
			print arr [ i ] ,
			max_from_right = arr [ i ]
arr = [ 16 , 17 , 4 , 3 , 5 , 2 ]
printLeaders ( arr , len ( arr ) )