Examveda

What will be the output of the following Python code?
class A:
    def __repr__(self):
        return "1"
class B(A):
    def __repr__(self):
        return "2"
class C(B):
    def __repr__(self):
        return "3"
o1 = A()
o2 = B()
o3 = C()
print(obj1, obj2, obj3)

A. 1 1 1

B. 1 2 3

C. '1' '1' '1'

D. An exception is thrown

Answer: Option B


Join The Discussion

Related Questions on Concept of Object Oriented Programs in Python