Create a Rectangle class (OOP)
Level: Real-World
Project Brief
Today we will practice object-oriented programming. Imagine you are developing a civil engineering application (e.g., AutoCAD) with Python. Your current task is to create a Python class that represents a rectangle geometrical figure. The Rectangle class should:
Two instance attributes, width, and height.
An area() method that returns the area of the rectangle.
A perimeter() method that returns the perimeter of the rectangle.
An is_square() method that returns True if the rectangle is a square and False (or None) if it is not.
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.


