Let's draw a vertical line on the coordinate plane:
we have that the vertical line passes through the points (x,y_1) and (x,y_2). So if we want to find the slope this would happen:
[tex]m=\frac{y_2-y_1}{x_2-x_1}=\frac{y_2-y_1}{x-x}=\frac{y_2-y_1}{0}_{}[/tex]So, we have that a vertical line have undefined slope since the denominator becomes 0 when we calculate the slope.
Now for the horizontal line, we have the following:
If we calculate the slope we get the following:
[tex]m=\frac{y_2-y_1}{x_2-x_1}=\frac{y-y}{x_2-x_1}=\frac{0}{x_2-x_1}=0[/tex]As we can see, the slope of a horizontal line is 0 since the values of the numerator become 0, and that is defined as a real number.