Help understanding solution
Solved it and tried to understand solutions of other people. Can't figure out >items[indexes[x]:indexes[x+1]][::-1]< in the following solution:
def reverse_ascending(items): indexes = [0, ] for x in range(len(items)-1): if items[x] >= items[x+1]: indexes.append(x+1) indexes.append(len(items)) new_items = [] for x in range(len(indexes)-1): new_items.extend(items[indexes[x]:indexes[x+1]][::-1]) return new_items
I undestand that array[x][y] is used if array[x] is itself an array. I don't see how in the above >indexes< gets a nested array inside and how this indexing works. Couldn't find on google (maybe coz I don't know how to search). Thx in advance for any explanation.