human
How to sort an array in a single loop ? | Function for Sorting the array using a single loop.
Sorting using a single loop.
Type Conversion of char to int ..
Comparing the ascii code ..
Swapping of the characters.
Declaring a String.
declaring character array.
copying the contents of the string to char array.
Printing the original Array ..
Sorting the array using a single loop.
Printing the sorted array ."
How can the above be solved in Python?

Can you provide a code to how to sort an array in a single loop?
assistant
#Here is code to how to sort an array in a single loop .
 def sortArrays ( arr , length ) :
	j = 0
	while ( j < length - 1 ) :
		d1 = arr [ j ]
		d2 = arr [ j + 1 ]
		if ( d1 > d2 ) :
			temp = arr [ j ]
			arr [ j ] = arr [ j + 1 ]
			arr [ j + 1 ] = temp
			j = - 1
		j += 1
	return arr
geeks = " GEEKSFORGEEKS "
n = len ( geeks )
arr = [ 0 ] * n
for i in range ( n ) :
	arr [ i ] = geeks [ i ]
print ( " Original ▁ array : ▁ [ " , end = " " )
for i in range ( n ) :
	print ( arr [ i ] , end = " " ) if ( i + 1 != n ) : print ( " , ▁ " , end = " " ) print ( " ] " )
ansarr = sortArrays ( arr , n )
print ( " Sorted ▁ array : ▁ [ " , end = " " )
for i in range ( n ) :
	print ( ansarr [ i ] , end = " " ) if ( i + 1 != n ) : print ( " , ▁ " , end = " " ) print ( " ] " )