Project Brief
Yesterday, we coded a Rectangle class that had a width and a height attribute. The class also had an area(), perimeter(), and an is_square() method.
Your task for today is to add two magic methods to that class __str__ and __eq__. The __str__ method should return a string representation of the Rectangle and __eq__ should enable comparing two different rectangle instances returning True or False based on whether the rectangles are similar or not (i.e., have the same width and height).
Expected Output
Keep reading with a 7-day free trial
Subscribe to Daily Python Projects to keep reading this post and get 7 days of free access to the full post archives.