chain of responsibility pattern def function_ (in_string)print(in_stringreturn "join([ for in in_string if !' ']def main_function(input_string)if ' in input_stringinput_string function_ (input_stringif ' in input_stringinput_string function_ (input_stringif ' in input_stringinput_string function_ (input_stringif ' in input_stringinput_string function_ (input_stringprint(input_stringif __name__ ="__main__"main_function(" "yesyou are right--all the functions do exactly the same thingbut this is just because of the way the sample problem is set up if you were to refer to the original problemyou would see that this is not always the case what should also feel off is the series of if statements that will only grow in length as more functions are added to the execution queue finallyyou may have noted how closely coupled the main_function is to each of the functions being executed implementing chain of responsibility in our project nowlet' solve the same problem using the idea we began to build earlier class catchall(object)def __init__(self)self next_to_execute none def execute(selfrequest)print(request