Question: class rectangle: def _ init _ ( self , length, width ) : self.length = length self. width = width self.color = 'purple' def _
class rectangle:
definitself length, width:
self.length length
self. width width
self.color 'purple'
defstrself:
result "rectangle: strselflength by strselfwidth
return result
def area self:
return selfwidth selflength
def perimeterself:
return selfwidth self.length
myRectangle rectangle
printmyRectangle
printArea: myRectangle.area
printPerimeter: myRectangle.perimeter
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
