The slope can be found by using the formula: m = (color(red)(y_2) - color(blue)(y_1))/(color(red)(x_2) - color(blue)(x_1))
Where m is the slope and (color(blue)(x_1, y_1)) and (color(red)(x_2, y_2)) are the two points on the line.
Substituting the values from the points in the problem and solving for p gives:
3 = (color(red)(p) - color(blue)(-4))/(color(red)(0) - color(blue)(-2))
3 = (color(red)(p) + color(blue)(4))/(color(red)(0) + color(blue)(2))
3 = (p + 4)/2
color(red)(2) * 3 = color(red)(2) * (p + 4)/2
6 = cancel(color(red)(2)) * (p + 4)/color(red)(cancel(color(black)(2)))
6 = p + 4
6 - color(red)(4) = p + 4 - color(red)(4)
2 = p + 0
2 = p
p = 2