# Lesson goal: Slope of a line

Previous: Drawing circles with the mouse | Home | Next: Using for-loops to count

The slope of a line is most commonly quoted as the "rise over the run." More precisely, this means the $\Delta y$ over $\Delta x$, or $m=\Delta y/\Delta x$, where $m$ is commonly assigned to be the "slope." Now, do you remember how the slope works? Does a vertical line have an infinite slope or a zero slope? What about a horiztonal line? What about a $45^\circ$ line? Which lines have negative slopes?

In this lesson, you will be able to investigate these properties of the slope, by drawing any line of your choice with two mouse clicks, like was done in this lesson.

When you get the code below to work, click once, then click again to draw a line. The program will compute and tell you $\Delta y$, $\Delta x$, and the slope of your line. See if you can answer the questions posed above.

# Now you try. Run this code several times, then click on two points. Try to learn properties of the slope of a line!

This code will not run. You have to fix three things. First, the dy= line which is supposed to be $\Delta y$, which here is $y_2-y_1$. Second is the dx= line which is supposed to be $\Delta x$ which here is $x_2-x_1$. Finally, you need to fix the m= line to compute the slope of the mouse-clicked line which is $\Delta y/\Delta x$. Can you do it? Dismiss.
Show a friend, family member, or teacher what you've done!