PythiloEasy · 10 min · Task 1 of 20 · progress kept in this browser

Rotate a list

A rotation moves items off the right end and back in at the left. Rotating [1, 2, 3, 4] right by one gives [4, 1, 2, 3].

rotate_right([1, 2, 3, 4], 1)
# [4, 1, 2, 3]
rotate_right([1, 2, 3], 4)
# [3, 1, 2]
Your task

Write rotate_right(items, k) returning a new list rotated right by k places, where k is 0 or more.