HackerRank: Left Array Rotation in Python
This is the easiest way I can think of to do a "shift" on a list in Python:

def shift_list(array, s):
    """Shifts the elements of a list to the left or right.

    Args:
        array - the list to shift
        s - the amount to shift the list ('+': left-shift, '-': right-shift)

    Returns:
        shifted_array - the shifted list
    """
    # calculate actual shift amount (e.g., 11 --&gt; 1 if length of the array is 5)
    s %= len(array)

    # uncomment this line to reverse the shift direction
    # s *= -1

    # shift array with list slicing
    shifted_array = array[s:] + array[:s]

    return shifted_array

my_array = [1, 2, 3, 4, 5]

# negative numbers
shift_list(my_array, -7)
&gt;&gt;&gt; [4, 5, 1, 2, 3]

# no shift on numbers equal to the size of the array
shift_list(my_array, 5)
&gt;&gt;&gt; [1, 2, 3, 4, 5]

# works on positive numbers
shift_list(my_array, 3)
&gt;&gt;&gt; [4, 5, 1, 2, 3]


If you need this to shift backwards (to the left) with negative numbers, add the following to the beginning of the shift list function:

s *= -1


I think the above documentation is sufficient to describe everything without being too wordy.

I have added this to the Stack Overflow Python docs.