So basically I have a list of strings say :
['cbad','hfig','qspr','uyxz'] I want to sort these strings in an alternate fashion without changing their relative position :
['abcd' ,'ihgf', 'pqrs', 'zyxu'] i.e. 'abcd' is sorted in ascending order, then 'ihgf' is sorted in 'descending order, then 'pqrs' is sorted in ascending and so on alternately.
So, instead of sorting these list of strings by looping through the list element wise, is there any other efficient way to do this in Python ? (keeping in mind that the list may contain a large number of elements).
Also, is it possible to do it in such that I can define a sort of custom order for sorting, like if I want every third element to be sorted in descending order. like this :
['abcd' ,'fghi', 'srqp', 'uxyz']