Now we’re going to embed the Point class inside another class…. Now we’re going to embed the Point class inside another class. Also, we’re going to put three points into one class, which will let us define a triangle. How can we do it?The new class will be called Triangle and this is the list of our expectations:the constructor accepts three arguments – all of them are objects of the Point class;the points are stored inside the object as a private list;the class provides a parameterless method called perimeter(), which calculates the perimeter of the triangle described by the three points; the perimeter is a sum of all legs’ lengths (we mention it for the record, although we are sure that you know it perfectly yourself.)Complete the template we’ve provided in the editor. Run your code and check whether the evaluated perimeter is the same as ours.Below you can copy the Point class codeCheckclass Point: def __init__(self, x=0.0, y=0.0):self.__x = xself.__y = yTemplateimport mathclass Point: # # The code copied from the previous lab. #class Triangle: def __init__(self, vertice1, vertice2, vertice3): # # Write code here # def perimeter(self): # # Write code here #triangle = Triangle(Point(0, 0), Point(1, 0), Point(0, 1))print(triangle.perimeter())Computer ScienceEngineering & TechnologyPython Programming INT 2240
solved : Now we’re going to embed the Point class inside another clas
How it works
- Paste your instructions in the instructions box. You can also attach an instructions file
- Select the writer category, deadline, education level and review the instructionsÂ
- Make a payment for the order to be assigned to a writer
- Â Download the paper after the writer uploads itÂ
Will the writer plagiarize my essay?
You will get a plagiarism-free paper and you can get an originality report upon request.
Is this service safe?
All the personal information is confidential and we have 100% safe payment methods. We also guarantee good grades
LET THE PROFESSIONALS WRITE YOUR PAPER!