Created
January 18, 2014 05:23
-
-
Save bmcculley/8486562 to your computer and use it in GitHub Desktop.
Given two points find the slope of a line using python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import division | |
# example points from http://www.coolmath.com/algebra/08-lines/06-finding-slope-line-given-two-points-01.htm | |
(x1, y1) = (-2,-1) | |
(x2, y2) = (4,3) | |
slope = ((y2-y1)/(x2-x1)) | |
print slope |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment