title: Iterate over every nth element in string in loop - python
body: <p><strong>How can iterate over every second element in string ?</strong></p>
  
  <p>One way  to do this would be(If I want to iterate over nth element):</p>
  
  <pre><code>sample = "This is a string"
  n = 3 # I want to iterate over every third element
  i = 1
  for x in sample:
      if i % n == 0:
          # do something with x
      else:
          # do something else with x
      i += 1
  </code></pre>
  
  <p>Is thery any "pythonic" way to do this? (I am pretty sure my method is not good)</p>