Compute area
Input
Rectangle(3, 4).area()
Output
12
The area is 3 * 4 = 12 using the instance attributes via self.
Full lesson preview
Practice using self to refer to instance attributes inside methods.
Problem statement
Task
Examples
Input
Rectangle(3, 4).area()
Output
12
The area is 3 * 4 = 12 using the instance attributes via self.
Input format
Output format
Constraints
Samples
Input
Rectangle(2.5, 4).area()
Output
10.0
Floating point multiplication should produce 10.0.