human
Program for array rotation | Function to left Rotate arr [ ] of size n by 1.
Function to left rotate arr [ ] of size n by d.
utility function to print an array.
Driver program to test above functions"
Solution in Python:
assistant
#Here is code to program for array rotation and the other steps required.
 def leftRotatebyOne ( arr , n ) :
	temp = arr [ 0 ]
	for i in range ( n - 1 ) :
		arr [ i ] = arr [ i + 1 ]
	arr [ n - 1 ] = temp
def leftRotate ( arr , d , n ) :
	for i in range ( d ) :
		leftRotatebyOne ( arr , n )
def printArray ( arr , size ) :
	for i in range ( size ) :
		print ( " % ▁ d " % arr [ i ] , end = " ▁ " )
arr = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 ]
leftRotate ( arr , 2 , 7 )
printArray ( arr , 7 )