21
What is the output of the following code?
class A: pass
class B(A): pass
print(isinstance(B(), A), issubclass(A, B))DiscussEasy
Loading subject content…
Loading practice questions…
What is the output of the following code?
class A: pass
class B(A): pass
print(isinstance(B(), A), issubclass(A, B))What is the output of the following code?
class Animal:
def sound(self):
return 'generic'
class Cat(Animal):
def sound(self):
return 'meow'
print(Cat().sound(), Animal().sound())What is the output of the following code?
class Bag:
def __init__(self):
self.items = [1, 2, 3]
def __len__(self):
return len(self.items)
print(len(Bag()))