From 7a7c0b9661867bc8561780a6521e3ef693a34296 Mon Sep 17 00:00:00 2001 From: Freezed Date: Thu, 16 Jul 2020 08:10:21 +0200 Subject: [PATCH] Add specs for `reorganize_string.py` --- technical_tests/reorganize_string.py | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 technical_tests/reorganize_string.py diff --git a/technical_tests/reorganize_string.py b/technical_tests/reorganize_string.py new file mode 100644 index 0000000..15cf120 --- /dev/null +++ b/technical_tests/reorganize_string.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +# coding: utf8 + +""" +Author: freezed 2020-07-16 +Licence: `GNU GPL v3` GNU GPL v3: http://www.gnu.org/licenses/ + +This file is part of [`free_zed/mypsb`](https://gitlab.com/free_zed/mypsb/) +""" + + +def main(string, n, sep): + """ + This function reorganize `string` by removing spaces & groups by `n` + characters separated by `sep`. + + :Tests: + >>> main("ab c de fgh ijk", 2, "|") + 'ab|cd|ef|gh|ij|k' + >>> main("ab c de fgh ijk", 3, "|") + 'abc|def|ghi|jk' + """ + answer = "" + + return answer + + +if __name__ == "__main__": + import doctest + + doctest.testmod()