input: Write a function to calculate the Gini coefficient of a given dataset.
  assert gini([2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,21])==0.605
  assert gini([1,1,1,1,1,100])==0.6875
  assert gini([1,2,3,4,5])==0.25
  assert gini([1,1,1,1,1])==0.0
  assert gini([])==None
output: def gini(data):
      if not data:
          return None
      n = len(data)
      if n == 0:
          return None
      data.sort()
      total = sum(data)
      gini_sum = 0
      for i in range(n):
          gini_sum += (2 * (i + 1) - n - 1) * data[i]
      return gini_sum / (n * total)