Bubble sort

 # Bubble sort


def fnBubbleSort(L):

for i in range(0,len(L)):

for j in range(0,len(L)-1):

if(L[j]>L[j+1]):

L[j],L[j+1]=L[j+1],L[j]

L = eval(input("Enter List of elements to be sorted : ")) 

fnBubbleSort(L)

print(L)

No comments:

Post a Comment

Don't be a silent reader...
Leave your comments...

Anu