> 
**Note**: This kata is a translation of this (Java) one: http://www.codewars.com/kata/rotate-array. I have not translated this first one as usual because I did not solved it, and I fear not being able to solve it (Java is **not** my cup of... tea). @cjmcgraw, if you want to use my translation on your kata feel free to use it.

Create a function named "rotate" that takes an array and returns a new one with the elements inside rotated n spaces.

If n is greater than 0 it should rotate the array to the right. If n is less than 0 it should rotate the array to the left. If n is 0, then it should return the array unchanged.

Example:
```python
data = [1, 2, 3, 4, 5];

rotate(data, 1) # => [5, 1, 2, 3, 4]
rotate(data, 2) # => [4, 5, 1, 2, 3]
rotate(data, 3) # => [3, 4, 5, 1, 2]
rotate(data, 4) # => [2, 3, 4, 5, 1]
rotate(data, 5) # => [1, 2, 3, 4, 5]

rotate(data, 0) # => [1, 2, 3, 4, 5]

rotate(data, -1) # => [2, 3, 4, 5, 1]
rotate(data, -2) # => [3, 4, 5, 1, 2]
rotate(data, -3) # => [4, 5, 1, 2, 3]
rotate(data, -4) # => [5, 1, 2, 3, 4]
rotate(data, -5) # => [1, 2, 3, 4, 5]
```

Furthermore the method should take ANY array of objects and perform this operation on them:
```python
rotate(['a', 'b', 'c'], 1)     # => ['c', 'a', 'b']
rotate([1.0, 2.0, 3.0], 1)     # => [3.0, 1.0, 2.0]
rotate([True, True, False], 1) # => [False, True, True]
```

Finally the rotation shouldn't be limited by the indices available in the array. Meaning that if we exceed the indices of the array it keeps rotating.

Example:
```python
data = [1, 2, 3, 4, 5]

rotate(data, 7)     # => [4, 5, 1, 2, 3]
rotate(data, 11)    # => [5, 1, 2, 3, 4]
rotate(data, 12478) # => [3, 4, 5, 1, 2]
```

Difficulty: introductory

Starter code:

def rotate(arr, n):
	

Solutions:
def rotate(arr, n):
    # ...
    n = n % len(arr)
    return arr[-n:] + arr[:-n]

from collections import deque


def rotate(arr, n):
    """Return a given array, rotated by n spaces."""
    rotator = deque(arr)
    rotator.rotate(n)
    return list(rotator)


def rotate(arr, n):
    dex = -(n % len(arr))
    return arr[dex:] + arr[:dex]


def rotate(arr, n):
    return arr[-n%len(arr):] + arr[:-n%len(arr)]

def rotate(lst, n):
    n %= len(lst)
    return lst[-n:] + lst[:-n]

def rotate(arr, n):
    new_arr = arr[:]
    for idx in range(len(arr)):
        new_idx = (idx + n) % len(arr)
        new_arr[new_idx] = arr[idx]
    return new_arr

def rotate(arr, n):
    rot = (-n)%len(arr)
    return arr[rot:] + arr[:rot]

def rotate(arr, n):
    if n > 0:
        n = n % len(arr)
    elif n < 0:
        n = len(arr) - (abs(n) % len(arr))

    arr = arr[-n:] + arr[0:-n]
    return arr

from numpy import roll

def rotate(arr, n):
  return list(roll(arr, n))

def rotate(l, n):
    return l[(len(l) - ((n % len(l)) + len(l)) % len(l)):] + l[:(len(l) - ((n % len(l)) + len(l)) % len(l))]