As an avid technologist I maintain my own home security cameras. These camera stream H.264 encoded 1080P video across my gigabit LAN to my home server, recording 24/7 footage for future reference. These clips are not only stored on my home server, they’re also processed via a custom Python script for motion, the results of which are logged to a file. I can easily see which video clips contain motion, and make it easier to locate something of interest.
The scenario might sound specific, but I am confident you’ve encountered something similar before. You need to construct an array, with a known number of duplicates of a string. Perhaps you’re constructing a template, and need a fixed number of placeholder elements, or you’re parameterizing a query and need a dynamic number of placeholders. In either case, you were probably left writing a rather ugly bit of logic in the middle of a routine that was otherwise focused on the task at hand.