Daily Python Projects

Daily Python Projects

Create a Rectangle class (OOP)

Level: Real-World

Ardit Sulce's avatar
Ardit Sulce
May 16, 2024
∙ Paid

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.

Already a paid subscriber? Sign in
© 2025 Ardit Sulce · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture