```python def average(values): if not values: return 0.0 total = 0 for v in values: total += v return total / len(values) ```