Example module¶
This module is not part of the project. It is here to serve as a style example and the subject of example unit tests.
Tip
To remove this module, its unit tests and documentation from the project, use the “clear_examples.sh” script in the project’s root folder
Docstrings are based on this example
Unit tests for this module are in: ../tests/test_example.py
-
str_repeat(s, n=1)[source]¶ Example function that repeats a string a number of times
Parameters: Returns: s repeated n times
Return type: Raises: TypeError– s not a string, or n not an integerValueError– n negative
Example
>>> str_repeat('a', 3) 'aaa' >>> str_repeat('and_again_', 3) 'and_again_and_again_and_again_' >>> str_repeat('x', -1) Traceback (most recent call last): ... ValueError: n negative