Question: need help with this code. (python) For this lab you will create a custom class that implements a point in 3-D space. Name your class

need help with this code. (python) need help with this code. (python) For this lab you will create

For this lab you will create a custom class that implements a point in 3-D space. Name your class 'pt3d. The class will have three attributes, x,y,z. These x,y,z values should default to zero. Given two instances of the pt3d class a and b. implement methods such that a+b returns a new pt3d object whose X, y and z values are the sum of the a and b x, y and z values a-b returns the Euclidean distance between points a and b a==b returns true if the x, y and z values of a and b are equal, false otherwise When you call print(a) the printout should be of the format '' You can test and develop your class either from the main block in your program, from another module, or using the python interpreter directly >>> from pt 3d import pt 3d >>> pl-pt3d (1,1,1) >>> p2=pt3d (2,2,2) >>> print (pl+p2) >>> print (pl-p2) 1.7320508075688772 >>> pl==p2 False >>> pl+pl==p2 True

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!