1.
a=[15,13,17,11]
b=list(a)
b.sort()
c=list(b)
for i in range(len(b)):
c[i]=a.index(b[i])
print c
-> [3, 1, 0, 2]
2.
a=[15,13,17,11]
c=list( [ a[i],i ] for i in range (len(a)) )
c.sort()
c
-> [[11, 3], [13, 1], [15, 0], [17, 2]]
Supporting MAC is my way to support Linux
1.
a=[15,13,17,11]
b=list(a)
b.sort()
c=list(b)
for i in range(len(b)):
c[i]=a.index(b[i])
print c
-> [3, 1, 0, 2]
a=[15,13,17,11]
c=list( [ a[i],i ] for i in range (len(a)) )
c.sort()
c
-> [[11, 3], [13, 1], [15, 0], [17, 2]]
No comments:
Post a Comment