title: Swapping uppercase and lowercase in a string
body: <p>I would like to change the chars of a string from lowercase to uppercase.</p>
  
  <p>My code is below, the output I get with my code is <code>a</code>; could you please tell me where I am wrong and explain why?
  Thanks in advance     </p>
  
  <pre><code>test = "AltERNating"
  
  def to_alternating_case(string):
      words = list(string)
      for word in words:
          if word.isupper() == True:
              return word.lower()
          else:
              return word.upper()  
  
  print to_alternating_case(test)
  </code></pre>