input: Write a Python function to calculate the Gini Coefficient of a given dataset.
  assert np.isclose(gini(np.array([2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,21])), 0.605)
  assert np.isclose(gini(np.array([1, 1, 1, 1, 1])), 0.0)
  assert np.isclose(gini(np.array([1, 2, 3, 4, 5])), 0.26666666666666666)
output: def gini(arr):
      import numpy as np
      arr = np.sort(arr)
      n = len(arr)
      cumulative_sum = np.cumsum(arr)
      gini_index = (2 * np.sum((np.arange(1, n + 1) * arr))) / (n * np.sum(arr)) - (n + 1) / n
      return gini_index