Creating Read-Only Computed Attributes

Medium Encapsulation & Data Hiding
Solve in Playground →

Problem Statement

Create a `Rectangle` class with `width` and `height`. Use the `@property` decorator to create a read-only computed attribute `area` that returns width * height. Read inputs, instantiate, and print ‘Area: [area]’.

Input Format

Two space-separated integers.

Output Format

Print the computed area.

Constraints

None

Sample Input

5 10

Sample Output

Area: 50

Explanation

If a property has a getter but no setter, it becomes read-only and is perfect for dynamic calculation.

Starter Code

class Rectangle:
    # Define __init__ and read-only property 'area'
    pass

if __name__ == '__main__':
    w, h = map(int, input().split())
    # Instantiate and print the area property
    pass

Limits

  • Time Limit: 1s
  • Memory Limit: 256MB

Embedded C Programming

Updated: March 15, 2026
Intermediate

Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used