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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started