# ---------------------------------
# File: Xiang/slope.py
# Author: Mihaela Malita IMPROVE!!
# Given two Points P1 and P2 find the slope m of the line.
# Xiang Appendix I page 285 A14
# Line from P1 to P2 has m= -2
# ---------------------------------
class Point:
def __init__(self,xcoord,ycoord):
self.x = xcoord
self.y = ycoord
def slope (P1,P2): # given two points find slope
return ( P2.y - P1.y ) / ( P2.x - P1.x )
def main():
P1 = Point(1,2)
P2 = Point(3,-2)
print "Line from P1 to P2 has m= ", slope(P1,P2)
main()