How do I print out individual words within my list?
<p>I am trying to print each word from my list onto separate lines, however it is printing each letter onto individual lines</p>

<pre><code>Words = sentence.strip()
for word in sentence:
    print (word)
</code></pre>

<p>My full code (for anyone wondering) is:</p>

<pre><code>import csv
file = open("Task2.csv", "w")
sentence = input("Please enter a sentence: ")
Words = sentence.strip()
for word in sentence:
    print (word)
for s in Words:
    Positions = Words.index(s)+1
    file.write(str(Words) + (str(Positions) + "\n"))
file.close()
</code></pre>

<p>You need to used <a href="https://docs.python.org/3.6/library/stdtypes.html#str.split" rel="nofollow"><code>str.split()</code></a> instead of <a href="https://docs.python.org/3.6/library/stdtypes.html#str.strip" rel="nofollow"><code>str.strip()</code></a>.</p>

<p><a href="https://docs.python.org/3.6/library/stdtypes.html#str.strip" rel="nofollow"><code>str.strip()</code></a> only removes the leading and trailing whitespaces in a string:</p>

<pre><code>&gt;&gt;&gt; my_string = '  This is a sentence.   '
&gt;&gt;&gt; my_string.strip()
'This is a sentence.'
</code></pre>

<p><a href="https://docs.python.org/3.6/library/stdtypes.html#str.split" rel="nofollow"><code>str.split()</code></a> does what you want which is return a list of the words in the string; by default, using whitespace as the delimiter string:</p>

<pre><code>&gt;&gt;&gt; my_string = '  This is a sentence.   '
&gt;&gt;&gt; my_string.split()
['This', 'is', 'a', 'sentence.']
</code></pre>

<p>So, your code should look more like:</p>

<pre><code>words = sentence.split()
for word in sentence:
    print(word)
</code></pre>

python