Question: Write Code in Python class Line: ''' Creates objects of the class Line, takes 2 tuples >>> line1=Line((-7,-9),(1,5.6)) >>> line1.distance 16.648 >>> line1.slope 1.825 >>>
Write Code in Python

class Line:
'''
Creates objects of the class Line, takes 2 tuples
>>> line1=Line((-7,-9),(1,5.6))
>>> line1.distance
16.648
>>> line1.slope
1.825
>>> line2=Line((2,6),(2,3))
>>> line2.distance
3.0
>>> line2.slope
'Infinity'
'''
def __init__(self, coord1, coord2):
#-- start code here ---
#-- ends here ---
#PROPERTY METHODS
def distance(self):
#-- start code here ---
#-- ends here ---
def slope(self):
#-- start code here ---
#-- ends here ---
[5 pts] 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. Tip: htt desa ntentW onte Coordinates must be provided as tuples when creating your class instances - Use the round method to format your output to 3 decimals [round(ouput value, 3) Incorrect format will result in -1 pt from your score EXAMPLES >>> line 1-Line( (8,3), (0,-4)) #Coordinates provided as tuple >>>linel.distance 10.63 >>>linel.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 >>>line3.slope Infinity Quotes mean method returned a string, no need to append them in your code
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
