Design a function in Python that takes a list of integers and returns the difference between the maximum and the minimum values.
data = [1, 5, 2, 3, 7, 9]
def getDifference(data):
 min_value = min(data)
 max_value = max(data)
 return max_value - min_value

difference = getDifference(data)
print(difference) # 8