human
Program to cyclically rotate an array by one | i and j pointing to first and last element respectively.
Driver function"
How can the above be solved in Python?
 Write me a code to program to cyclically rotate an array by one and the other steps required?
assistant
#Here is code to program to cyclically rotate an array by one and the other steps required.
 def rotate ( arr , n ) :
	i = 0
	j = n - 1
	while i != j :
	arr [ i ] , arr [ j ] = arr [ j ] , arr [ i ]
	i = i + 1
	pass
arr = [ 1 , 2 , 3 , 4 , 5 ]
n = len ( arr )
print ( " Given ▁ array ▁ is " )
for i in range ( 0 , n ) :
	print ( arr [ i ] , end = ' ▁ ' )
rotate ( arr , n )
print ( " Rotated array is " )
for i in range ( 0 , n ) :
	print ( arr [ i ] , end = ' ▁ ' )