human
Rearrange all elements of array which are multiples of x in increasing order | Function to sort all the multiples of x from the array in ascending order.
Insert all multiples of 5 to a vector.
Sort the vector.
update the array elements.
Driver code.
Print the result"
How can the above be solved in Python?
 Give me a code to rearrange all elements of array which are multiples of x in increasing order and the other steps required?
assistant
#Here is code to rearrange all elements of array which are multiples of x in increasing order and the other steps required.
 def sortMultiples ( arr , n , x ) :
	v = [ ]
	for i in range ( 0 , n , 1 ) :
		if ( arr [ i ] % x == 0 ) :
			v . append ( arr [ i ] )
	v . sort ( reverse = False )
	j = 0
	for i in range ( 0 , n , 1 ) :
		if ( arr [ i ] % x == 0 ) :
			arr [ i ] = v [ j ]
			j += 1
if __name__ == ' _ _ main _ _ ' :
	arr = [ 125 , 3 , 15 , 6 , 100 , 5 ]
	x = 5
	n = len ( arr )
	sortMultiples ( arr , n , x )
	for i in range ( 0 , n , 1 ) :
		print ( arr [ i ] , end = " ▁ " )