Let's take a look at what's going on here:
# Initialize the lists
a = ['a','b','d','c']
b = [1,2,4,3]
c = [[],[]]
# Assign the lists to positions in c
c[0]=a
c[1]=b
# Sort b, which was assigned to c[1]
c[1].sort()
print(c)
So, of course you could not expect a
to get sorted. Try this instead:
# Sort a, which was assigned to c[0]
c[0].sort()
# Sort b, which was assigned to c[1]
c[1].sort()
print(c)
Or if c
is of variable length:
# Sort every list in c
for l in c:
l.sort()
Edit: in response to your comment, the letters are not connected to the numbers in any way. If you want them to be connected, you need to join them in a structure like a tuple. Try:
>>> c = [ (1, 'a'), (2, 'b'), (4, 'd'), (3, 'c') ]
>>> c.sort()
>>> print c
[(1, 'a'), (2, 'b'), (3, 'c'), (4, 'd')]
By default, tuples will sort on their first element. Note that you could use any letters here in place of a, b, c, d, and the tuples would still sort the same (by number).