← All practice pages
Python
Python Inheritance
Inheritance lets one class build on another, keeping what it needs and replacing what it does differently. The shared behaviour lives in the base class.
Try it now
Use inheritance: write a base class "Shape" with an "area()" method, then "Circle" and "Rectangle" subclasses that override area() with the correct formula.
Create a free account to run your answer and get ARIA's review.