2016-01-21 21:07:07 -05:00

12 lines
323 B
Python

def titlecase(string, exceptions):
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']))