Bubble sort

bubble sort python full program

Hey internet mates here we are going to make a python program to sort the given list using bubble sort method.

Program code:-
li=[]
for x in range (0,10):
    inp=int(input("Enter no.:-"))
    li.append(inp)
print("Original list is:-",li)
ln=len(li)
for y in range(ln):
    for i in range(0,ln-y-1):
        if li[i]> li[i+1]:
            li[i],li[i+1]=li[i+1],li[i]
print("List after sorting:-",li)

Leave a Comment

Your email address will not be published. Required fields are marked *