My solution, I know the 'zip' version is more elegant, this is just for fun:) >>> items = ['apple', 'car', 'town', 'phone']
 >>> values = [5, 2, 7, 1]
 >>> new_values = sorted(values, reverse = True)
>>> new_items = [items[x] for x in [i for i in map(values.index, new_values)]]
 >>> print(new_values)
[7, 5, 2, 1]
 >>> print(new_items)
['town', 'apple', 'car', 'phone']
 >>>

Cool .. always good to know alternative ways of accomplishing
a task.

Esmail
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to