1

I put integers into list and then sort it:

a,b,c,d,e,f = 3,6,2,8,1,2
list1=[a,b,c,d,e,f]
list5.sort()

Now I want to print the sorted list as string, but to see the variables, like:

efcabd

I can't figure it out.

Thank you!

Matan
  • 146
  • 13
  • tldr: you can't really do it – R Nar Dec 02 '15 at 16:54
  • In short, you should not want it. More than one name may refer to the same value, and it's values that are stored, not names. If you want to name your values, explicitly pair the names (strings) and values: `l = [(1, 'a'), (3, 'b'), (2, 'a')]`. If you sort `l`, you can still extract the names. – 9000 Dec 02 '15 at 16:57
  • OP: you can't do that IN THIS WAY, but it sounds like what you want is to be able to sort those letters in some custom order. If you write up a new question talking about the problem you're trying to solve, rather than the way you're trying to solve it, we can probably help you! – Adam Smith Dec 02 '15 at 16:57

0 Answers0