Basic usage
Input
Rectangle('3x4').area()
Output
12
parse_size splits '3x4' into width=3 and height=4; area returns 3*4 = 12.
Full lesson preview
Learn to use a @staticmethod as a helper to parse input strings into structured data for a class.
Problem statement
Task
Examples
Input
Rectangle('3x4').area()
Output
12
parse_size splits '3x4' into width=3 and height=4; area returns 3*4 = 12.
Input format
Output format
Constraints
Samples
Input
Rectangle(' 6 , 7 ').area()
Output
42
Whitespace is ignored, parsed as width=6 height=7, area 42.