Question: We need help with creating a constructor to find the distance between two points. We're trying to get the output in the prompt below: Test

We need help with creating a constructor to find the distance between two points. We're trying to get the output in the prompt below:

We need help with creating a constructor to find the distance between

Test code. Do not change this.

two points. We're trying to get the output in the prompt below:

Your solution to this problem must meet the following criteria. 1. You must define a class Point in the file point. py with two attributes. - an integer for x with a default of 0 - an integer for y with a default of 0 2. Create a three instance methods in the Point class. - a constructor that take two optional arguments for x and y distance formula. - a special instance method to return a formatted string "(x,y)" for the point object 4. Below is an example of a call to the Point class which you could implement in point_test.py to test your class. Python Code: import point point1 = point.Point (1,1) point2 = point.Point (1,5) print( "The distance between \{\} and \{\} is \{\} ".format( point1, point2, point1.get_distance_to(point2) ) Output: The distance between (1,1) and (1,5) is 4.0 import point point1 = point.Point (1,1) point2 = point.Point (1,5) print( "The distance between \{\} and \{\} is \{\}. format( point1, point2, point1.get_distance_to(point2) )

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!