human
Count of rotations required to generate a sorted array | Function to return the count of rotations.
Find the smallest element.
Return its index.
If array is not rotated at all.
Driver Code"
How can the above be solved in Python?
 ... Give me a code to count of rotations required to generate a sorted array and the other steps required?
assistant
#Here is code to count of rotations required to generate a sorted array and the other steps required.
 def countRotation ( arr , n ) :
	for i in range ( 1 , n ) :
		if ( arr [ i ] < arr [ i - 1 ] ) :
			return i
	return 0
if __name__ == " _ _ main _ _ " :
	arr1 = [ 4 , 5 , 1 , 2 , 3 ]
	n = len ( arr1 )
	print ( countRotation ( arr1 , n ) )