Skip to content

Instantly share code, notes, and snippets.

@bmcculley
Created January 18, 2014 05:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmcculley/8486562 to your computer and use it in GitHub Desktop.
Save bmcculley/8486562 to your computer and use it in GitHub Desktop.
Given two points find the slope of a line using python.
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