给定一组整数，创建一个函数，该函数返回这些数的平均值、最小值和最大值。

nums = [3, 8, 1, 5, 9]
# TODO: create function to calculate average, min, and max
```python
def calculate_stats(nums):
  avg = sum(nums) / len(nums)
  min_num = min(nums)
  max_num = max(nums)
  return avg, min_num, max_num
```

调用：

```python
nums = [3, 8, 1, 5, 9]
avg, min_num, max_num  = calculate_stats(nums)
print(f"Average: {avg}, Min: {min_num}, Max: {max_num}")
``` 

输出：

```python
Average: 5.2, Min: 1, Max: 9
```