input: from typing import List
  
  def gini(x: List[float]) -> float:
      """Calculate Gini Coefficient of a given dataset.
      >>> gini([2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,21])
      0.605
      """
      import numpy as np
      
      x_value_counts = np.unique(x, return_counts=True)
      
      x_cum_sum = np.cumsum(x_value_counts[1])
      
      n = len(x)
      lorenz = x_cum_sum / n
      lorenz = np.insert(lorenz, 0, 0)
      
      width = lorenz[:-1] - lorenz[1:]
      gini_coef = (1 / n) * sum(width * (lorenz[1:] + lorenz[:-1]))
      
      return gini_coef
output:     import numpy as np
      
      x_value_counts = np.unique(x, return_counts=True)
      
      x_cum_sum = np.cumsum(x_value_counts[1])
      
      n = len(x)
      lorenz = x_cum_sum / n
      lorenz = np.insert(lorenz, 0, 0)
      
      width = lorenz[:-1] - lorenz[1:]
      gini_coef = (1 / n) * sum(width * (lorenz[1:] + lorenz[:-1]))
      
      return gini_coef