input: def gini(x):
      """Calculate Gini Coefficient of a given dataset.
      >>> 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:     import numpy as np
  
      x = np.sort(x)
      n = len(x)
      index = np.arange(1, n + 1)
      return (np.sum((2 * index - n - 1) * x)) / (n * np.sum(x))