Rectangle area
Input
Rectangle(3, 4).area()
Output
12.0
Area of a 3x4 rectangle is 12. total_area should return floats (rounded to 6 decimals).
Full lesson preview
Design a Shape interface with multiple subclasses and compute total area polymorphically.
Problem statement
Task
Examples
Input
Rectangle(3, 4).area()
Output
12.0
Area of a 3x4 rectangle is 12. total_area should return floats (rounded to 6 decimals).
Input format
Output format
Constraints
Samples
Input
total_area([Rectangle(3,4), Circle(1)])
Output
15.141593
Rectangle area 12 + circle area pi ≈ 3.141592653589793 => sum ≈ 15.141592653589793 rounded to 6 decimals => 15.141593