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!

Type your code here:


See your results here: