Search⌘ K

Challenge 1: Implement a Rectangle Class

Understand how to implement a Rectangle class in Python by defining its constructor to store x and y coordinates of two corners. Learn to use the self keyword to initialize class instances and validate rectangle creation based on coordinate input.

Problem Statement

  1. Implement a class named Rectangle to store the coordinates of a rectangle given the top-left corner (x1, y1) and the bottom-right corner (x2, ...