input: Write a python function to calculate the Gini index of a list of numbers.
  assert gini_index([10, 3, 5, 7]) == 0.6015625
  assert gini_index([1, 1, 1, 1]) == 0.75
  assert gini_index([0, 0, 0, 1]) == 0.0
  assert gini_index([2, 4, 6, 8]) == 0.68
output: def gini_index(numbers):
      n = len(numbers)
      if n == 0:
          return 0
      mean_absolute_difference = sum(abs(x - y) for x in numbers for y in numbers) / (2 * n**2)
      mean_value = sum(numbers) / n
      return 1 - mean_absolute_difference / mean_value if mean_value != 0 else 0