def draw_line(r, g, b, y1, x1, y2, x2, grid):
    """Draws a line on the ppm grid

    Arguments
    --------
    r, g, b -- RGB values for line
    m1, n1 -- start point of line
    m2, n2 -- end point of line
    grid -- ppm grid
    """
    dx = x2 - x1
    dy = y2 - y1
    x = [x for x in range(x1, x2+1)]

    for x_i in x:
        y_i = y1 + dy*(x_i - x1) / (dx + 10**-15)
        grid[round(y_i)][x_i] = [r, g, b]

    return grid