Instance Methods | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Instance Methods

Fill in the blanks to define the Box class area method that returns the product (multiplication) of its instance variables.

8th Dec 2022, 2:32 PM
Javohir Mamaniyazov
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.
9th Dec 2022, 11:41 AM
Sadaam Linux
Sadaam Linux - avatar
+ 3
Please tag the relevant programming language and link the code.
8th Dec 2022, 3:14 PM
Lisa
Lisa - avatar