human
Pancake sorting | Reverses arr [ 0. . i ].
Returns index of the maximum element in arr [ 0. . n - 1 ].
The main function that sorts given array using flip operations.
Start from the complete array and one by one reduce current size by one.
Find index of the maximum element in arr [ 0. . curr_size - 1 ].
Move the maximum element to end of current array if it 's not already at  the end.
To move at the end , first move maximum number to beginning.
Now move the maximum number to end by reversing current array.
A utility function to print an array of size n.
Driver program"
How can the above be solved in Python?

=====
Give me a code to pancake sorting and the other steps required?
assistant
#Here is code to pancake sorting and the other steps required.
 def flip ( arr , i ) :
	start = 0
	while start < i :
		temp = arr [ start ]
		arr [ start ] = arr [ i ]
		arr [ i ] = temp
		start += 1
		i -= 1
def findMax ( arr , n ) :
	mi = 0
	for i in range ( 0 , n ) :
		if arr [ i ] > arr [ mi ] :
			mi = i
	return mi
def pancakeSort ( arr , n ) :
	curr_size = n
	while curr_size > 1 :
		mi = findMax ( arr , curr_size )
		if mi != curr_size - 1 :
			flip ( arr , mi )
			flip ( arr , curr_size - 1 )
		curr_size -= 1
def printArray ( arr , n ) :
	for i in range ( 0 , n ) :
		print ( " % d " % ( arr [ i ] ) , end = " ▁ " )
arr = [ 23 , 10 , 20 , 11 , 12 , 6 , 7 ]
n = len ( arr )
pancakeSort ( arr , n ) ;
print ( " Sorted ▁ Array ▁ " )
printArray ( arr , n )