title: Comparing characters in a string in Python
body: <p>I want to compare following chars in a string and if they're equal, raise the counter. 
  With my example code I always get TypErrors related to line 6.
  Do you know where's the problem?</p>
  
  <p>Thank you!</p>
  
  <pre><code>def func(text):
      counter = 0
      text_l = text.lower()
  
      for i in text_l:
          if text_l[i+1] == text_l[i]:
              print(text_l[i+1], text_l[i])
              counter += 1
  
      return counter
  </code></pre>