Problem Statement
When the same code or logic is copied in multiple places, it becomes hard to maintain. Fixing a bug or updating a feature requires changes in many spots, increasing the chance of errors and inconsistencies.
This diagram shows two places with repeated code replaced by calls to a single reusable function, centralizing the logic.
### Before applying DRY (repeated code) def calculate_area_rectangle(width, height): return width * height def calculate_area_square(side): return side * side # Both functions repeat multiplication logic ### After applying DRY (reusable function) def multiply(a, b): return a * b def calculate_area_rectangle(width, height): return multiply(width, height) def calculate_area_square(side): return multiply(side, side)