human
Index the first and the last n elements of a list
assistant
Here is some code to get the first and last 3 elements of list `l`

l[:3] + l[-3:]

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.