Jan-24-2017, 10:50 AM
That is definitely a way to do it, though if you have a sequence in which relative order matters but sorting would give a different order it might not be what you want.
For example:
For example:
>>> a = [5, 6, 2, 9, 13 ,2] >>> sorted(a*2) [2, 2, 2, 2, 5, 5, 6, 6, 9, 9, 13, 13] >>>Definitely something to consider though.