From 1e1e8f1f0316ab4379821f72cca7ad67f3784fb2 Mon Sep 17 00:00:00 2001 From: william Date: Thu, 21 Jan 2016 21:07:07 -0500 Subject: [PATCH] worked on stuff --- 1-title_case/title.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/1-title_case/title.py b/1-title_case/title.py index dd2557b..c60cd82 100644 --- a/1-title_case/title.py +++ b/1-title_case/title.py @@ -1,2 +1,12 @@ def titlecase(string, exceptions): - pass + words = string.lower().split(' ') + new_words = [] + for word in words: + if word in exceptions: + new_words.append(word) + else: + new_words.append(word.capitalize()) + + return ' '.join(new_words) + +print(titlecase('the quick brown fox jumps over the lazy dog', ['jumps', 'the', 'over'])) \ No newline at end of file