Sep-13-2020, 06:37 AM
Note that you can turn get_area into property using @property decorator.
class Rectangle: def __init__(self, width, height): self.width = width self.height = height @property def area(self): return self.width * self.height rect = Rectangle(10, 2) print(rect.area)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs