LearnPy Hub
← Classes & Objects problems
Medium

Total Area

Write classes Square(side) and Rect(w, h), each with area(). Read lines square s or rect w h until END and print the total area.

Input

Shapes, then END.

Output

The total area.

Sample 1

Input
square 2
rect 3 4
END
Output
16

Sample 2

Input
rect 1 1
END
Output
1
solution.py
Output appears here
Total Area · Python practice problem · LearnPy Hub