Program - Bubble sort in python


Topic: Program - Bubble sort in python

Solution

list1 = [1, 5, 3, 4]
for i in range(len(list1)-1):
  for j in range(i+1,len(list1)):
    if(list1[i] > list1[j]):
      temp = list1[i]
      list1[i] = list1[j]
      list1[j] = temp
print("Bubble Sorted list: ",list1)



List all Python Programs