input: Write a function to rotate the elements of an array to the left by a given number of positions.
  assert rotate([1, 2, 3, 4, 5], 2) == [3, 4, 5, 1, 2]
  assert rotate([1, 2, 3, 4, 5], 3) == [4, 5, 1, 2, 3]
  assert rotate([1, 2, 3, 4, 5], 5) == [1, 2, 3, 4, 5]
  assert rotate([1, 2, 3, 4, 5], 0) == [1, 2, 3, 4, 5]
output: def rotate(arr, positions):
      n = len(arr)
      positions = positions % n  # handle positions greater than array length
      return arr[positions:] + arr[:positions]