The collections module has deque class which provides the rotate ( ) , which is inbuilt function to allow rotation
arr = deque ( arr ) NEW_LINE arr . rotate ( - k ) NEW_LINE arr = list ( arr ) NEW_LINE