15 The Kentucky Friar: More regular expressions

I grew up in the American Deep South where we tend to drop the final “g” of words ending in “ing,” like “cookin’” instead of “cooking.” We also tend to say “y’all” for the second-person plural pronoun, which makes sense because Standard English is missing a distinctive word for this. In this exercise, we’ll write a program called friar.py that will accept some input as a single positional argument and transform the text by replacing the final “g” with an apostrophe (’) for two-syllable words ending in “ing” and changing “you” to “y’all.” Granted, we have no way to know if we’re changing the first- or second-person “you,” but it makes for a fun challenge nonetheless.

Figure 15.1 is a string ...

Get Tiny Python Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.