Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Exercise: rectangle

Take the Rect class in the shapes module. Implement rmul, but in that case multiply the width of the rectangle.

Implement the addition of two rectangles. I think this should be defined only if one of the sides is the same, but if you have an idea how to add two rectangualars of different sides, then go ahead, implement that.

Also implement all the comparision operators when comparing two rectangles, compare the area of the two. (like less-than) Do you need to implement all of them?