Shift items through slots
Your task
A packing line has a fixed row of slots holding item codes. When a new item enters at the left end, every item shifts one slot to the right and the item in the last slot drops off the end of the line. Given the current slots and the entering item, return the row after the shift. A row with no slots stays empty. Example: [1, 2, 3] with new item 9 becomes [9, 1, 2].
Examples
line_shift(slots: list[int], item: int) -> list[int]Example 1
Input
line_shift([1, 2, 3], 9)Output
[9, 1, 2]