top of page
Click here to go to the home page of AskTheCode.

Sort a list of elements using bubble sort algorithm

Team ATC

Asked: Anonymously |Category: Python


 

a=[8,4,1,3,2,6]

for i in range(len(a)):

for j in range(1,len(a)):

if a[j-1]>a[j]:

a[j-1],a[j]=a[j],a[j-1]

print(a)

 
 
 

Recent Posts

See All

Comments


bottom of page