diff options
| author | Mohammad Sajid Anwar <mohammad.anwar@yahoo.com> | 2024-07-24 17:52:14 +0100 |
|---|---|---|
| committer | Mohammad Sajid Anwar <mohammad.anwar@yahoo.com> | 2024-07-24 17:52:14 +0100 |
| commit | 668b77d43a561d1ee523754a5d40c839e30a2997 (patch) | |
| tree | 774cf6e409afbe5f81ed336b6cfd546c7159ff63 | |
| parent | 4c04dea9f2e76d161a43ebb5f1d03827be112272 (diff) | |
| parent | a990df737d3dc4908227daa14507d9ff97716ed9 (diff) | |
| download | perlweeklychallenge-club-668b77d43a561d1ee523754a5d40c839e30a2997.tar.gz perlweeklychallenge-club-668b77d43a561d1ee523754a5d40c839e30a2997.tar.bz2 perlweeklychallenge-club-668b77d43a561d1ee523754a5d40c839e30a2997.zip | |
Merge remote-tracking branch 'refs/remotes/origin/master'
| -rw-r--r-- | challenge-279/steven-wilson/python/ch-2.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/challenge-279/steven-wilson/python/ch-2.py b/challenge-279/steven-wilson/python/ch-2.py index be2b25d38f..0b9478b238 100644 --- a/challenge-279/steven-wilson/python/ch-2.py +++ b/challenge-279/steven-wilson/python/ch-2.py @@ -22,8 +22,11 @@ def split_string(string, print_strings=False): return False if print_strings: - split_index = int(len(position_vowels)/2) - 1 - (start, stop) = (position_vowels[split_index], position_vowels[split_index+1]) + if len(position_vowels) < 2: + (start, stop) = (0, len(string)-1) + else: + split_index = int(len(position_vowels)/2) - 1 + (start, stop) = (position_vowels[split_index], position_vowels[split_index+1]) pprint([(string[:i+1], string[i+1:]) for i in range(start, stop)]) return True |
