#!/bin/python
def insertionSort(list):
for i in xrange(1,len(list)):
value=list[i]
pos=i
while pos>0 and value <list[pos-1]:
list[pos]=list[pos-1]
print list
pos-=1
list[pos]=value
return list
m = input()
list = [int(i) for i in raw_input().strip().split()]
insertionSort(list)
This is my output:
[2, 4, 6, 8, 8]
[2, 4, 6, 6, 8]
[2, 4, 4, 6, 8]
But I need the same result but without brackets and commas.
2 4 6 8 8
2 4 6 6 8
2 4 4 6 8
2 3 4 6 8
I tried to use print ' '.join(list)
but still didn't work.