Vidyalelo
Python · Q62

Classes and Objects in Python

Programming · Python · question 62

Q62

What will be the output of the following Python code? >>> class demo(): def __repr__(self): return '__repr__ built-in function called' def __str__(self): return '__str__ built-in function called' >>> s=demo() >>> print(s)

A.
Error
B.
Nothing is printed
C.
__str__ called
Answer
D.
__repr__ called

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board