How can i create a function which sort a list in this way for example if list 4,4,2
4,4,2
3,3,1,3
2,2,0,2,4
1,1,0,1,3,4
0,0,0,0,2,3,4
0,0,0,0,0,1,2,3,4
If the list is impossible to sort then the program have to try it 15 times not more.
The function which I wrote does it only one time not more??
x=[4,4,2]
def kopi(x):
b=0
y = []
for j in x:
b+=1
y.append(j-1)
y.append (b)
print y,b
return y
can anyone help me?
Thanks a lot for all help and advice.