Cyclically rotate

Given an array, cyclically rotate the array clockwise by one time.

Hint

Start with the first item. Save the first item, remember this item for later. Shift the rest of the list by moving each item one position to the left. This creates an empty space at the end of the list. Place the saved item, the item you saved earlier, at the end to fill the empty space.

# Python implementation
ls = [1, 2, 3, 4, 5, 6, 7, 8, 9]
last = ls[0]

for i in range(len(ls) - 1):
  ls[i] = ls[i + 1]

ls[-1] = last

print(ls)
// Javascript implementation
const list = [1, 2, 3, 4, 5, 6, 7, 8, 9];
const last = list[0];

for (let i = 0; i < list.length - 1; i++) {
  list[i] = list[i + 1];
}

list[list.length - 1] = last;

console.log(list);