# question 1
def rotateR(val):
    return val[-1] + val[:-1] if len(val) > 0 else None


# question 4
def rotateRx(val):
    val[:] = [val[-1]] + val[:-1]


# question 5
def rotateRx_modified(val):
    # cannot be modified to work for strings, without returning a value. Python strings are immutable. They cannot be
    # modified once they are created:
    # ```TypeError: 'str' object does not support item assignment```
    # So the only way to achieve this would be to return a value and assign it back.
    pass

# question 6


def rotateR2(val):
    return rotateR(rotateR(val))


# question 7
def rotateRx2(val):
    rotateRx(val)
    rotateRx(val)


# question 8
l = [[1, 2, 3]] * 2
print(l)
rotateRx(l[1])
print(l)