All challenges

Tuesday, 3 November 2026

Past

Three rungs, one idea. Solving rung 1 counts. Climb as far as you can.

Spinning The List

lists + rotating items

Rung 1Daily goal5 points

First one to the back

Write a function called first_to_back

Take the first item of the list and move it to the back. Everything else moves one place forward, so [1, 2, 3] becomes [2, 3, 1]. An empty list gives an empty list.

Examples

InputOutput
[1, 2, 3][2, 3, 1]
[][]
[7][7]
["red", "blue", "green"]["blue", "green", "red"]

There are extra hidden tests, so make it work in general, not just for these.

Rung 2Bonus7 points

Do it again and again

Write a function called rotate_left

Now move the first item to the back k times, one after another. [1, 2, 3, 4] with a k of 2 gives [3, 4, 1, 2]. k can be bigger than the length of the list, and the items just keep going round. An empty list gives an empty list.

Examples

InputOutput
[1, 2, 3, 4], 2[3, 4, 1, 2]
[1, 2, 3], 0[1, 2, 3]
[], 5[]
[9], 3[9]

There are extra hidden tests, so make it work in general, not just for these.

Rung 3Bonus10 points

Slide to the right

Write a function called shift_right

This time the items slide k places to the right and do not come back round. Items that slide off the end are lost, and the empty places at the front are filled with 0. So [1, 2, 3, 4] with a k of 1 gives [0, 1, 2, 3]. The answer is always as long as the list you started with, and an empty list gives an empty list.

Examples

InputOutput
[1, 2, 3, 4], 1[0, 1, 2, 3]
[1, 2, 3], 0[1, 2, 3]
[], 2[]
[5], 1[0]

There are extra hidden tests, so make it work in general, not just for these.

Finish Rung 1 and today counts. Rungs 2 and 3 are there if you want to push further.