human
Smallest greater elements in whole array | Efficient Python3 program to find smallest greater element in whole array for every element.
lowerbound function.
Driver code"
How can the above be solved in Python?

=====
What is a code to smallest greater elements in whole array and the other steps required?
assistant
#Here is code to smallest greater elements in whole array and the other steps required.
 def smallestGreater ( arr , n ) :
	s = set ( )
	for i in range ( n ) :
		s . add ( arr [ i ] )
	newAr = [ ]
	for p in s :
		newAr . append ( p )
	for i in range ( n ) :
		temp = lowerBound ( newAr , 0 , len ( newAr ) , arr [ i ] )
		if ( temp < n ) :
			print ( newAr [ temp ] , end = " ▁ " )
		else :
			print ( " _ ▁ " , end = " " )
def lowerBound ( vec , low , high , element ) :
	array = [ 0 ] * ( len ( vec ) )
	k = 0
	for val in vec :
		array [ k ] = val
		k += 1
	while ( low < high ) :
		middle = low + int ( ( high - low ) / 2 )
		if ( element > array [ middle ] ) :
			low = middle + 1
		else :
			high = middle
	return low + 1
if __name__ == ' _ _ main _ _ ' :
	ar = [ 6 , 3 , 9 , 8 , 10 , 2 , 1 , 15 , 7 ]
	n = len ( ar )
	smallestGreater ( ar , n )