Vidyalelo
Python · Q57

Concept of Object Oriented Programs in Python

Programming · Python · question 57

Q57

What will be the output of the following Python code? class A: def __init__(self, x, y): self.x = x self.y = y def __str__(self): return 1 def __eq__(self, other): return self.x * self.y == other.x * other.y obj1 = A(5, 2) obj2 = A(2, 5) print(obj1 == obj2)

A.
False
B.
1
C.
True
Answer
D.
An exception is thrown

Answer: Option C

Solution

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