Python Quest

Track 11 · Lesson 7 of 12

Inheritance

Build specialised classes on top of general ones, inherit their attributes and methods, and test types with isinstance and issubclass.

About 40 minIntermediate4 exercises

You will be able to

  • Recognise an is-a relationship and model it with a subclass
  • Define a subclass that inherits __init__, attributes and methods from its parent
  • Add new methods and class attributes in a subclass
  • Explain how Python looks up a method through the class hierarchy
  • Use isinstance and issubclass, including with subclasses

Included with a Formula Quest membership

It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.

View Formula Quest memberships

Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.