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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.