I need to write a program that can capitalise each word in a sentence (which is stored as a list of words), without affecting the capitalisation of other parts of the sentence.
Let's say, for example, the sentence is 'hello, i am ROB ALSOD'. In a list, this would be:
['hello,','i','am','ROB','ALSOD']
I understand that I could loop through and use the str.title()
method to title them, but this would result in:
['Hello,','I','Am','Rob','Alsod']
Notice the difference? The effect I am going for is:
['Hello,','I','Am','ROB','ALSOD']
In other words, I want to keep other capitalised letters the same.