Why do I only print the first letters of each item in the list?
<p>I was wondering why I only print the first letter of each item I input. I would like for it to loop through the list and print each item that starts with one of the letters in the first_letters variable. </p>

<pre><code>phrase = input('Enter a list: ')
first_letters = ['A','B','C','D']
for name in phrase:
    if name[0] in first_letters: 
        print(name)

#['Alpha', 'Bravo', 'Charlie', 'Delta', 'Echo', 'Foxtrot']
</code></pre>

<p>What @idjaw meant to say was the input which is a string is an <code>iterable</code>.</p>

<p>Which means when you run the for loop on <code>name</code> it iterates over each letter in the string passed.</p>

<p>If you'd want to read a list or store the input as a list, it'd be best to store the result as a space or comma separated input.</p>

<p>eg. </p>

<pre><code>results_from_input = "abc def ghi"
results = results_from_input.split(" ") 

print(results)
#['abc', 'def', 'ghi']
</code></pre>

<p>then you can iterate over results.</p>

python