Question: Write the class Line that stores the coordinates of two points in a line and provides the distance between the two points and the slope

Write the class Line that stores the coordinates of two points in a line and provides the distance between the two points and the slope of the line using the property methods called distance and slope. Unless the slope is equal to infinity, both methods must return the value as float.

EXAMPLES: >>> line1=Line((8,3),(0,-4)) #Coordinates provided as tuple >>> line1.distance 10.63 >>> line1.slope 0.875 >>> line2=Line((-7,-9),(1,5.6)) >>> line2.distance 16.648 >>> line2.slope 1.825 >>> line3=Line((2,6),(2,3)) >>> line3.distance 3.0 >>> line3.slope 'Infinity

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!