l=[1,9,6,2,7,8,4]
n=len(l)
for i in range(n-1):
    for j in range(0,n-1):
        if(l[j]>l[j+1]):
            l[j],l[j+1]=l[j+1],l[j]

print(l)            

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: