You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose you have a point object and wish to find the midpoint halfway between it and some other target point. We would like to write a method, let’s call it halfway, which takes another Point as a parameter and returns the Point that is halfway between the point and the target point it accepts as input.
"""
class Point:
"""
Describes the point with x and y co-ordinates
"""
def __init__(self, intX, intY):
"""
Initializes the variables
:param intX: assigns to x
:param intY: assigns to y
"""
self.x = intX
self.y = intY
def getX(self):
"""
returns the x values
:return: returns x
"""
return self.x
def getY(self):
"""
returns the y values
:return: return y
"""
return self.y
def halfway(self, other):
"""
Proivdes the halfway between the points
:param other: Instance of the Point object
:return: returns the Point object which is the midway between two points