input: 
  from typing import List
  
  
  def gini(x: List[int]) -> 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
      """
  
output:     total = sum(x)
      n = len(x)
      squared_sum = sum((value / total) ** 2 for value in x)
      return (1 - squared_sum) * (n / (n - 1)) if n > 1 else 0.0