Bubble sort

a bubble sort is a type of sort that is used it sort numbers by comparing one number to the next and swapping them if the second one is bigger than the first and if not it will compair the second with a third and so on until it gets to the end of the list when it will go back to the start and repeat the process until it can go through the whole list and make no changes (there is a graphical exampel bellow)
if you want to write this in code there are a few things you need to do as well as getting a loop to check through the numbers and swap them you will need to make sure that the loop stops at the end of the list and does not try to carry on, you will also need to make sure that the program stops after it has finished sorting here is some code that would work in python although keep in mind there are other methods.

import random
numbers = []
for x in range (random.randint(1, 30)):
 numbers.append(random.randint(1, 100))
for x in range (len(numbers)):
 print (numbers [x])
#counting value
c = 0
nosort = 0
end = 0
#length
l = len(numbers)-1
print("----------------")
print("random list:", numbers)
print("----------------")
print("random ist length:", l+1)
print("----------------")
while True:
 if c >= l:
  c=0
 elif numbers[c+1] < numbers[c]:
  temp = numbers[c]
  numbers[c] = numbers[c+1]
  numbers[c+1] = temp
  nosort = 0
 elif nosort >= len(numbers):
  print("list sorted:", numbers)
  break
 else:
  nosort = nosort + 1
  c = c+1
print("----------------")

exampel