1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
   | class StrategyExecutor():
      def __init__(self, func=None):         if func is not None:             self.execute = func          def execute(self, *args):         print("Strategy not implemented")          def strategy_addition(arg1, arg2):         print(arg1 + arg2)          def strategy_subtraction(arg1, arg2):         print(arg1 - arg2)
  def main():     no_strategy = StrategyExecutor()     addition strategy - Strategyexecutor (strategy_addition)     subtraction_strategy = StrategyExecutor (strategy_subtraction) no_strategy.execute(4, 6)     addition_strategy,execute(4, 6) subtraction_strategy.execute(4, 6)
  if __name__ == "__main__":     main()
   |