def sort(obj): obj_len = len(obj) return [ obj[i * 2] if i < (obj_len / 2 + obj_len % 2) else obj[2 * obj_len - 2 * i - 1] for i in range(obj_len) ] print sort(range(10)) print sort(range(11))