fork download
  1. def abc(a):
  2. for i in range(1,len(a)):
  3. c=a[i]
  4. j=i-1
  5. while j>=0 and a[j]>c:
  6. a[j+1]=a[j]
  7. j-=1
  8. a[j+1]=c
  9. a=[25,56,74,12,34,18]
  10. abc(a),
  11. print("sorted array:",a)
Success #stdin #stdout 0.05s 9596KB
stdin
Standard input is empty
stdout
sorted array: [12, 18, 25, 34, 56, 74]