A List Of Functions
We'll cover the following...
We'll cover the following...
Now you’re going to add a level of abstraction. You started by defining a list of rules: if this, do that, otherwise go to the next rule. Let’s temporarily complicate part of the program so you can simplify another part.
① Now, each match rule is its own function which returns the results of calling the re.search() function.
② Each apply rule is also its own function which calls the re.sub() function to apply the appropriate pluralization rule.
③ Instead of having one function (plural()) with multiple rules, you have the rules data structure, which is a sequence of pairs of functions.
④ Since the rules have been ...