diff options
Diffstat (limited to 'challenge-253/sgreen/python/ch-1.py')
| -rwxr-xr-x | challenge-253/sgreen/python/ch-1.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/challenge-253/sgreen/python/ch-1.py b/challenge-253/sgreen/python/ch-1.py new file mode 100755 index 0000000000..661c767134 --- /dev/null +++ b/challenge-253/sgreen/python/ch-1.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 + +import sys + + +def split_strings(words, sep): + # Join the words together by the separator + combined = sep.join(words) + + # Split them by the separator excluding empty strings + return [ w for w in combined.split(sep) if w != ''] + +def main(inputs): + # The separator is the last character + sep = inputs.pop() + result = split_strings(inputs, sep) + print('"' + '", "'.join(result) + '"') + +if __name__ == '__main__': + main(sys.argv[1:])
\ No newline at end of file |
