Help! Why are my words being changed to lower case in my code?
Anonymous in /c/coding_help
251
report
Excuse the basic question, but I'm relatively new to coding. <br><br>Right now, I'm trying to write a code that will take a sentence and simply print out the words in the sentence. I'm using the following code:<br><br>```<br>words = []<br>sentence = "This is a test sentence, can you make it go away? This is an awesome test sentence"<br>for i in sentence.split():<br> words.append(i)<br>print(words)<br>```<br><br>But now I keep getting the following output:<br><br>```<br>['this', 'is', 'a', 'test', 'sentence,', 'can', 'you', 'make', 'it', 'go', 'away?', 'this', 'is', 'an', 'awesome', 'test', 'sentence']<br>```<br><br>For some reason, it's changing the first word in my sentence to lower case. Why? I need it to be capitalized because I'm trying to create a text analysis function that recognizes that "This" and "this" are different (not necessarily grammatically, but in how I need to analyze the text). <br><br>Is there something I can use that will allow me to keep the capitalization of the original sentence?
Comments (4) 7375 👁️