input: def gini(x):
      """Calculate Gini Coefficient of a given dataset.
      Example:
      >>> x = np.array([2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 21])
      >>> gini(x)
      0.605
      """
output:     x = sorted(x)
      n = len(x)
      numerator = sum((i + 1) * x[i] for i in range(n))
      denominator = n * sum(x)
      gini_coeff = (2 * numerator) / denominator - (n + 1) / n
      return gini_coeff