Question: class rectangle: def _ init _ ( self , length, width ) : self.length = length self. width = width self.color = 'purple' def _

class rectangle:
def_init_(self, length, width):
self.length = length
self. width = width
self.color = 'purple'
def_str__(self):
result = "rectangle: "+ str(self.length)+" by "+ str(self.width)
return result
def area (self):
return self_width * self_length
def perimeter(self):
return 2*(self.width + self.length)
myRectangle = rectangle (5,7)
print(myRectangle)
print("Area:", myRectangle.area())
print("Perimeter:-", myRectangle.perimeter())
 class rectangle: def_init_(self, length, width): self.length = length self. width =

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!