Write a Python code to compute the average of all numbers in a list.
numbers = [2, 8, 4, 3]
def average(numbers):
    total = 0
    for num in numbers:
        total += num
    return total / len(numbers)