Why this for loop in Python3 return dictionary value split in letters?
<p>I am lerning Python from a book and there is this example. I rewrote example as it is shown in book, but the result differs from books.</p>

<p><strong>This is the code</strong></p>

<pre><code>favorite_languages = {
   'jen': ['python','ruby'],
   'bil': 'c',
   'edward': ['ruby','haskell'],
   'phil': 'python',
   'marcis': ['octave','python','mysql'],
   }

for name, languages in favorite_languages.items():
    print("\n" +name.title()+"'s favorite language(s) are:")
    for language in languages:
        print("\t" + language.title())
</code></pre>

<p>This is the consoles printed result. Problem as you see are in the way console prints value 'python' for Phil's sentence.</p>

<p><a href="https://i.stack.imgur.com/qgyQq.png" rel="nofollow"><img src="https://i.stack.imgur.com/qgyQq.png" alt="Console spells word Python by letters in each line"></a></p>

<p>I have tried other IDLE and the same result!<br>
<strong>Why does name python is spelled by letters in each line for Phil's example? Is it an some sort of Python language or my code problem?</strong></p>

<p>Because line:</p>

<pre><code>for language in languages:
</code></pre>

<p>is iterating over string 'python' and giving you single letters, if you write it as ['python'] it'll iterate over list and write it as one word</p>

python python-3.x for-loop dictionary