diff options
Diffstat (limited to 'challenge-330/deadmarshal/python/ch2.py')
| -rw-r--r-- | challenge-330/deadmarshal/python/ch2.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/challenge-330/deadmarshal/python/ch2.py b/challenge-330/deadmarshal/python/ch2.py new file mode 100644 index 0000000000..4e18e8df30 --- /dev/null +++ b/challenge-330/deadmarshal/python/ch2.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +def title_capital(s): + words = s.split() + arr = [] + for word in words: + if len(word) < 3: + arr.append(word.lower()) + else: + arr.append(word.capitalize()) + return ' '.join(arr) + +print(title_capital('PERL IS gREAT')) +print(title_capital('THE weekly challenge')) +print(title_capital('YoU ARE A stAR')) + |
