August 2018
Intermediate to advanced
248 pages
5h 51m
English
In this example, we will implement a banner generator. The idea is rather simple. We want to send some text to a function, and the function should generate a banner containing the text. Banners have some sort of style, for example, dots or dashes surrounding the text. The banner generator has a default style, but we should be able to provide our own style.
The generate_banner() function is our Template function. It accepts, as an input, the text (msg) that we want our banner to contain, and the style (style) that we want to use. The generate_banner() function wraps the styled text with a simple header and footer. In reality, the header and footer can be much more complex, but nothing forbids us from calling functions that can ...