给定一组数，编写代码来计算它们的平均值和中位数。


numbers = [2, 4, 6, 8, 10]
代码实现如下：

```
numbers = [2, 4, 6, 8, 10]

# 计算平均值
average = sum(numbers) / len(numbers)

# 计算中位数
numbers.sort()
mid = len(numbers) // 2
if len(numbers) % 2 == 0:
    median = (numbers[mid-1] + numbers[mid]) / 2
else:
    median = numbers[mid]

print("平均值为：", average)
print("中位数为：", median)
```