+ 1
Instance Methods
Fill in the blanks to define the Box class area method that returns the product (multiplication) of its instance variables.
2 Answers
+ 5
class Box:
def __init__(self, length, width, height):
self.length = length
self.width = width
self.height = height
def area(self):
return self.length * self.width * self.height
The area method takes no arguments (besides the self argument that refers to the instance itself) and returns the product of the length, width, and height instance variables.
+ 3
Please tag the relevant programming language and link the code.