from random import randint
def buble(array):
global count
count = 1
end = -len(array)
replaced = True
while replaced == True:
replaced = False
for el in range(-1,end,-1):
if array[el]<=array[-1+el]:
array[el],array[-1+el] = array[-1+el],array[el]
replaced = True
print(count, ":" ,"\n",array,"\n")
end+=1
count+=1
return array;
N = randint(10,50)
array = []
for i in range (N):
array.append(randint(0,60))
print("now:",array,"\n")
print("result:",buble(array),"in ",count-1,"iterations",15*"\n")