nums = [8,90,19,12,7,6,55,98]; for i in range(len(nums)-2): swapped = False; for j in range(len(nums)-1-i): if j == 0: j = 1; if nums[j-1] > nums[j]: temp = nums[j]; nums[j] = nums[j-1]; nums[j-1] = temp; swapped = True; if not swapped: break; print(nums);