Rotating an array
Question
Write a Python function that rotates a given array by p elements, where p is the function's input. Below are a couple examples of the input array, p, and the resulting output:

Input: array = [1, 2, 3, 4, 5, 6], p = 3

Output: [4, 5, 6, 1, 2, 3]

Input: array = [1, 2, 3, 4, 5, 6], p = 10

Output: [3, 4, 5, 6, 1, 2]