strategy pattern this solution results in the followingstrategy not implemented - this is what we want sadlywe suffer from the same problem we encountered in previous namely that whenever we want to add another strategy to the reducerwe have to add another elif statement to the function together with another block of code to handle that strategy this is surefire way to grow sprawling if statement we would much prefer more modular solution that would allow us to pass in new strategies on the fly without our having to alter the code that uses or executes the strategy as you have come to expect by nowwe have design pattern for that this design pattern is aptly named the strategy pattern because it allows us to write code that uses some strategyto be selected at runtimewithout knowing anything about the strategy other than that it follows some execution signature once againwe turn to an object to help us solve this problem we will also reach for the fact that python treats functions as first-class citizenswhich will make the implementation of this pattern much cleaner than the original implementation we will start with the traditional implementation of the strategy pattern class strategyexecutor(object)def __init__(selfstrategy=none)self strategy strategy def execute(selfarg arg )if self strategy is noneprint("strategy not implemented "elseself strategy execute(arg arg class additionstrategy(object)def execute(selfarg arg )print(arg arg class subtractionstrategy(object)def execute(selfarg arg )print(arg arg