Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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) image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions