title: How to uppercase even letter and lowercase odd letter in a string?
body: <p>I am creating a function that takes in a string and returns a matching string where every even letter is uppercase and every odd letter is lowercase. The string only contains letters</p>
  
  <p>I tried a for loop that loops through the length of the string with an if statement that checks if the index is even to return an upper letter of that index and if the index is odd to return a lowercase of that index.</p>
  
  <pre><code>def my_func(st):
      for index in range(len(st)):
          if index % 2 == 0:
              return st.upper()
          else:
              return st.lower()
  </code></pre>
  
  <p>I expected to have even letters capitalize and odd letter lowercase but I only get uppercase for the whole string.</p>