LLD Logo
LVL1
Visitor Pattern

Step 1 of 4 · Define shape and visitor roles

1

Your task

Define shape and visitor roles

Declare the accept operation and one visitor method per shape.

Give shapes an accept operation.
Give visitors a method for Circle and Rectangle.
Return a numeric result for the calculator lesson.

shape_contracts.py

Your draft · saved locally

1

Structural feedback only—your code stays in this browser and is not executed.