title: Control Structure in Python
body: <p>I am wondering why this piece of code:</p>
  
  <pre><code>wordlist = ['cat','dog','rabbit']
  letterlist=[]
  for aword in wordlist:
      for aletter in aword:
          if aletter not in letterlist:
              letterlist.append(aletter)
  print(letterlist)
  </code></pre>
  
  <p>prints ['c', 'a', 't', 'd', 'o', 'g', 'r', 'b', 'i']</p>
  
  <p>while this code:</p>
  
  <pre><code>wordlist = ['cat','dog','rabbit']
  letterlist=[]
  for aword in wordlist:
      for aletter in aword:
          letterlist.append(aletter)
  print(letterlist)
  </code></pre>
  
  <p>prints ['c', 'a', 't', 'd', 'o', 'g', 'r', 'a', 'b', 'b', 'i', 't']</p>
  
  <p>I don't understand how the code is being computed and doesn't spell out all of 'rabbit' and/or why it spells out 'r', 'b', 'i'? Anyone know what's going on?</p>