Challenge #2: Extend Functionality Without Modifying Existing Code
You have a Shape class with a calculate_area method that calculates the area of different shapes (e.g., circle, rectangle). The method currently uses conditional statements to handle different shapes.
class Shape:
def calculate_area(self, shape):
if shape['type'] == 'circle':
return 3.14 * shape['radius'] ** 2
elif shape['type'] == 'rectangle':
return shape['width'] * shape['height']Task:
Refactor the
Shapeclass to adhere to the Open/Closed Principle.Implement a design that allows adding new shapes without modifying the existing code.

