user
Create a function that computes the average of an array of numbers.
Input: [1, 2, 3, 4, 5]
Output:
assistant
def avg(nums):
    sum = 0
    for num in nums:
        sum += num
    return sum / len(nums)  # Output: 3.0