p
y
c
h
a
l
l
e
n
g
e
r
Home
Intermediate Python
Classes and OOP II
Use an Inherited Attribute
Use an Inherited Attribute
A subclass picks up the parent's attributes for free. Read the inherited
kingdom
attribute from a subclass instance.
Premium
reset
def greet(name): return f"Hello, {name}!" print(greet("Erik"))
Python
Setting up Python environment...
Output