LearnPy Hub
← Inheritance & Special Methods problems
Medium

Shapes and Areas

Shape has area() returning 0 and describe() returning NAME with area A (2 decimals). Circle(r), Square(s) and Triangle(b, h) override area. Read shapes until END and print each description.

Input

Lines like 'circle 1', then END.

Output

One line each.

Sample 1

Input
circle 1
square 2
END
Output
Circle with area 3.14
Square with area 4.00

Sample 2

Input
triangle 3 4
END
Output
Triangle with area 6.00
solution.py
Output appears here
Shapes and Areas · Python practice problem · LearnPy Hub