I have a python list which I want to order. I can only think of one way todo this so far which is to have a dictionary and according to that dictionary value depends on the position.
How can I do this better?
These are the values
>>> a = ['Extra large', 'Large', 'Small', 'Medium', 'Extra Small']
>>> b = ['XL', 'XS', 'XXXL', 'L', 'M']
What i want to be able to produce
>>> a = ['Extra Small', 'Small', 'Medium', 'Large', 'Extra large']
>>> b = ['XS', 'XL', 'M', 'L', 'XXXL']
I was thinking of having a diction like this but i'm sure there is a better way todo it that looping through each value?
size_mapping = {
0: ['small', 's'],
1: ['medium', 'm'],
2: ['large', 'l']
}