buble sort

def buble_sort(lst): last_index=len(lst)-2 while last_index !=-1 : i=0 while i<=last_index : if lst[i]>lst[i+1]: temp=lst[i] lst[i]=lst[i+1] lst[i+1]=temp i+=1 last_index -=1 return lst while True : n=input("enter the list of numbers :") print buble_sort(n)

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.