Let's follow an example, each line is equivalent to the one after it:
mystery([22,14,19,65,82,55])
mystery([22,14,19,65,82,55][1:]) + [22,14,19,65,82,55][:1]
mystery([14,19,65,82,55]) + [22]
mystery([14,19,65,82,55][1:]) + [14,19,65,82,55][:1] + [22]
mystery([19,65,82,55]) + [14] + [22]
...
mystery([19,65]) + [82] + [55] + [14] + [22]
mystery([19,65][1:]) + [19, 65][:1] + [82] + [55] + [14] + [22]
mystery([65]) + [19] + [82] + [55] + [14] + [22]
mystery([65][1:]) + [65][:1] + [19] + [82] + [55] + [14] + [22]
mystery([]) + [65] + [19] + [82] + [55] + [14] + [22]
[] + [65] + [19] + [82] + [55] + [14] + [22]
[65, 19, 82, 55, 14, 22]
If you don't understand what [:1]
[1:]
means please read this SO question.