def bubblesort(array)
i = 0
swapped = true
length = array.length
while i < length-1 and swapped do # also check for end of array
swapped = false
n = i +1 # second loop variable 'n' should be initialized here
while n < length
if array[i] > array[n]
dummy = array[i]
array[i]= array[n]
array[n] = dummy
swapped = true
end
n+=1 # 'n' should be incremented here...
end
i += 1 # and 'i' here
end
return array
end
ret = bubblesort([10,3,4,6,1,4,2])
x = 0
while x < ret.length
print ret[x], ' '
x+=1
end