Points compare equal and can be dictionary keys
Input
({Point(2, 3): 'a'})[Point(2, 3)]
Output
a
Point(2, 3) used to index the dictionary must match the key because equality and hash are consistent.
Full lesson preview
Make custom objects usable as dictionary keys and set members by implementing both __eq__ and __hash__ correctly.
Problem statement
Task
Examples
Input
({Point(2, 3): 'a'})[Point(2, 3)]
Output
a
Point(2, 3) used to index the dictionary must match the key because equality and hash are consistent.
Input format
Output format
Constraints
Samples
Input
Point(1,1) == Point(1,1)
Output
True
Points with identical coordinates are equal.