Edit the following Python function so that it returns a list of the factors of a number.
def factors(n):
    return
def factors(n):
    factors =[]
    for i in range(1, n + 1):
        if n % i == 0:
            factors.append(i)
    return factors