super() in a diamond of classes
Predict the outputHardPython only
class A:
def hi(self):
return "A"
class B(A):
def hi(self):
return "B" + super().hi()
class C(A):
def hi(self):
return "C" + super().hi()
class D(B, C):
def hi(self):
return "D" + super().hi()
print(D().hi())
print([k.__name__ for k in D.__mro__])
This question is part of Pro+
Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.