You are viewing a single comment's thread. Return to all comments →
foo[i:j:k] gives a slice of list foo from i to j (but not including j) by step k
when i or j is omitted, it takes the whole range, so [::1] means "from first to last". but if k is negative, the order is reversed, so [::-1] means "from last to first"
it's a cute way of getting the list in reverse order, in other words
so then he uses the  index to get the second element in the reversed list, which gives the runner-up value
could just have used [-2] instead of forcing the list to be reversed