index from end
^1 means the last item, ^2 the one before it.
The hat operator ^n denotes the index n positions from the end; ranges a..b select elements from a up to but not including b.
Examples
codes[^1]is the last item, andcodes[1..^1]is everything except the first and the last.