# Step 1
class Point:
    """ A 2-dimensional point

    Attributes:
        @type x: float
        units to the right of the origin
        @type y: float
        units above the origin
    """

    # these comments are just for your reference
    # always (or at least almost always)
    # start with __init__ to set up a new object
    # __str__ for you in debugging
    # __eq__ so we can compare things

    def __init__(self, x, y):
        """ Create a new Point object that is x
        units to the right of the origin and
        y units above the origin.

        @type self: Point
        @type x: float | int # float OR int
        @type y: float | int
        @rtype: None
        """

        # attributes on Left, arguments on Right
        self.x = float(x)
        self.y = float(y)


    def __eq__(self, other):
        """ Return whether this Point is the
        same as other.

        @type self: Point
        @type other: Point | Any
        @rtype: bool
        """

        # we want to be able to compare a Point
        # object to anything
        # Point(1, 1) == ['cat']

        # if we assume other is a Point
        #return self.x == other.x and \
        #    self.y == other.y
        # but other.x will produce an error
        # if the object other does not have
        # an attribute x

        return type(self) == type(other) and \
            self.x == other.x and \
            self.y == other.y



    def __str__(self):
        """ Return a readable string
        representation of this Point.

        @type self: Point
        @rtype: str

        """

        return '({0}, {1})'.format(self.x, self.y)


    def distance_to_origin(self):
        """ Return the distance from this Point to the origin.

        @type self: Point
        @rtype: float

        >>> p1 = Point(0, 0)
        >>> p1.distance_to_origin()
        0.0
        >>> p2 = Point(3, 4)
        >>> p2.distance_to_origin()
        5.0
        """

        # Notice that we're about to write code that would solve this
        # in the distance method

        return self.distance(Point(0, 0))

    def distance(self, other):
        """ Return the distance from this Point to the Point other.

        @type self: Point
        @type other: Point
        @rtype: float

        >>> p1 = Point(0, 0)
        >>> p2 = Point(0, 0)
        >>> p1.distance(p2)
        0.0
        >>> p3 = Point(3, 4)
        >>> p1.distance(p3)
        5.0
        """

        return ((self.x - other.x) ** 2 + (self.y - other.y) ** 2) ** 0.5

    def move(self, change_to_x, change_to_y):
        """ Update this Point's x and y values to reflect the values
        of change_to_x and change_to_y.

        @type self: Point
        @type change_to_x: float | int
        @type change_to_y: float | int
        @rtype: None

        >>> p1 = Point(1, 2)
        >>> p1.move(0.5, 3)
        >>> p1.x
        1.5
        >>> p1.y
        5.0
        >>> p1.move(0, -1)
        >>> p1.x
        1.5
        >>> p1.y
        4.0
        """

        self.x += change_to_x
        self.y += change_to_y

    def __add__(self, other):
        """ Return a new Point that is the Point self plus the Point other.

        >>> p1 = Point(1, 1)
        >>> p2 = Point(2, 2)
        >>> p3 = p1 + p2
        >>> str(p3)
        '(3, 3)'
        """

        return Point(self.x + other.x, self.y + other.y)


# Step 2 - client code
if __name__ == '__main__':
    p1 = Point(5, 2)
    print(p1.distance_to_origin())
    p2 = Point(3, 3)
    print(p1.distance(p2))
    p1.move(-2, 1)
    #p1.midpoint(p2)
    print(p1 == p2)