79741431

Date: 2025-08-20 18:10:56
Score: 1
Natty:
Report link

You need an _eq_ in Point. Otherwise, Python is comparing two objects by their addresses, and always coming up False.

class Point:
    def __init__(self, x, y):
        self.x = x
        self.y = y
    
    def __eq__(self, other):
        if not isinstance(other, Point):
            return False
        return self.x == other.x and self.y == other.y 
Reasons:
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: trandolph