11
What is the output of the following code?
class Base: pass
class Leaf(Base): pass
print(issubclass(Leaf, Base), isinstance(Base(), Leaf))DiscussEasy
Loading subject content…
Loading practice questions…
What is the output of the following code?
class Base: pass
class Leaf(Base): pass
print(issubclass(Leaf, Base), isinstance(Base(), Leaf))What is the output of the following code?
class A:
def who(self): return 'A'
class B:
def who(self): return 'B'
class C(B, A): pass
print(C().who(), [k.__name__ for k in C.__mro__][:3])What is the output of the following code?
class T:
@staticmethod
def add(a, b):
return a + b
@classmethod
def name(cls):
return cls.__name__
print(T.add(2, 3), T.name())What is the output of the following code?
class A:
def hi(self):
return 'A'
class B(A):
def hi(self):
return 'B' + super().hi()
print(B().hi())What is the output of the following code?
class A:
def hello(self):
return 'A'
class B(A):
def hello(self):
return 'B' + super().hello()
print(B().hello())