strategy pattern def main()executor( executor( strategy_additionexecutor( strategy_subtractionif __name__ ="__main__"main(as beforeyou can see that the output matches the requirementstrategy not implemented - we created function that could take pair of arguments and strategy to reduce them at runtime multiplication or division strategyor any binary operation to reduce the two values to single valuecan be defined as function and passed to the reducer we do not run the risk of sprawling if growing in our executor and causing code rot to appear one thing that is bit bothersome about the preceding code snippet is the else statement in the executor we know that we will usually not be printing text in the terminal as the result of something happening inside our program it is way more likely that the code will return some value since the print statements are used to demonstrate the concepts we are dealing with in the strategy pattern in tangible manneri will implement the strategy patternusing print statement in the main function to simply print out the result of the executor this will allow us to use an early return to get rid of the dangling elseand thus clean up our code even more the cleaned-up version of our code now looks something like thisdef executor(arg arg func=none)if func is nonereturn "strategy not implemented return func(arg arg def strategy_addition(arg arg )return arg arg