3 ms·
list(range(n)) is probably because the author was using Python 3, in which range() returns an iterator (think xrange in 2.x). The double indexing is probably be
by StavrosK 16y ago
list(range(n)) is probably because the author was using Python 3, in which range() returns an iterator (think xrange in 2.x). The double indexing is probably because a[:] returns a copy of a and the author doesn't want to iterate over the modified array, since he modifies it down the line (although the [2:] would copy it too, so no idea).
An alternative to a[:][2:] would just be range(2, n), but the author clearly doesn't want it to be readable.