Alternating Characters

  • + 0 comments
        count = 0
        i = 0
        for i in range(i, len(s)-1):
           if s[i] == s[i+1]:
              count = count + 1         
        return count