fork download
  1. list1 = [4,9,6,2,7]
  2. n = len(list1)
  3. for i in range(n):
  4. for j in range(i+1,n):
  5. if list1[i]> list1[j]:
  6. list1[i],list1[j] = list1[j] ,list1[i]
  7. print(list1)
Success #stdin #stdout 0.01s 7200KB
stdin
Standard input is empty
stdout
[2, 4, 6, 7, 9]