Question: (Python 2.7) I'm trying to access the vertices variable from the SierpinskiTriangle class and use it in the second bit of code listed but it

 (Python 2.7) I'm trying to access the vertices variable from the

(Python 2.7) I'm trying to access the vertices variable from the SierpinskiTriangle class and use it in the second bit of code listed but it shows TypeError: 'property' object is not iterable I can only assume it is due to the accessors/mutators Base code: class Fractal (object): # the constructor def init_(self, dimensions): # the canvas dimensions self.dimensions dimensions t the default number of points to plot is 58,80e self.num points 5eeea the default distance ratio is 0.5 (halfway) self.r e.5 # accessors and mutators def vertices (self): return self. vertices @vertices.setter def vertices (self, v): selfvertices v - class SierpinskiTriangle(Fractal): # the constructor def init_(self, canvas): call the constructor in the superclass Fractal._init__(self, canvas) # define the vertices based on the fractal size v1 - Point(self.dimensions["mid_x"], self.dimensions [ "min y"]) v2 Point (self.dimensions["min_x"], self.dimensions [ "max_y"]) v3Point(self.dimensions["max_x"], self.dimensions [ "max_y"]) self.vertices [ vl, v2, v3 ] Code to get vertices in: class ChaosGame (Canvas): vertex_radius 2 vertex_color "red point_color "black" def init_(self, master): Canvas._init_(self, master, bg "white") self.pack(fill BOTH, expand = 1) # a function that takes a string that represents the fractal to create def make(self, f): if f"SierpinskiTriangle": if f"SierpinskiCarpet" if f"Pentagon": if f "Hexagon". ifOctagon" vertices SierpinskiTriangle.vertices vertices [] vertices [] vertices [] vertices[ print vertices for point in vertices self.plot_point(self, point, ChaosGame.vertex_color, ChaosGame.vertex_radius) (Python 2.7) I'm trying to access the vertices variable from the SierpinskiTriangle class and use it in the second bit of code listed but it shows TypeError: 'property' object is not iterable I can only assume it is due to the accessors/mutators Base code: class Fractal (object): # the constructor def init_(self, dimensions): # the canvas dimensions self.dimensions dimensions t the default number of points to plot is 58,80e self.num points 5eeea the default distance ratio is 0.5 (halfway) self.r e.5 # accessors and mutators def vertices (self): return self. vertices @vertices.setter def vertices (self, v): selfvertices v - class SierpinskiTriangle(Fractal): # the constructor def init_(self, canvas): call the constructor in the superclass Fractal._init__(self, canvas) # define the vertices based on the fractal size v1 - Point(self.dimensions["mid_x"], self.dimensions [ "min y"]) v2 Point (self.dimensions["min_x"], self.dimensions [ "max_y"]) v3Point(self.dimensions["max_x"], self.dimensions [ "max_y"]) self.vertices [ vl, v2, v3 ] Code to get vertices in: class ChaosGame (Canvas): vertex_radius 2 vertex_color "red point_color "black" def init_(self, master): Canvas._init_(self, master, bg "white") self.pack(fill BOTH, expand = 1) # a function that takes a string that represents the fractal to create def make(self, f): if f"SierpinskiTriangle": if f"SierpinskiCarpet" if f"Pentagon": if f "Hexagon". ifOctagon" vertices SierpinskiTriangle.vertices vertices [] vertices [] vertices [] vertices[ print vertices for point in vertices self.plot_point(self, point, ChaosGame.vertex_color, ChaosGame.vertex_radius)

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!