生成Python函数，该函数计算给定列表中数字的平均值。


def calculate_average(numbers):
# TODO: write code to calculate the average of numbers
return mean

numbers = [45, 67, 89, 34, 56, 71, 80]
下面是计算平均值的Python函数的示例：

```python
def calculate_average(numbers):
    # 计算数字之和
    total_sum = sum(numbers)
    
    # 计算数字个数
    num_count = len(numbers)
    
    # 计算平均数，使用float确保结果是浮点类型
    mean = float(total_sum) / num_count
    
    return mean

numbers = [45, 67, 89, 34, 56, 71, 80]
print(calculate_average(numbers))
```

输出：
```python
62.42857142857143
```