title: Find the value of a String in i-th position
body: <p>I have a binary String. I add 1 at every 7-th position in that string. Using the following code.</p>
  
  <pre><code> binary='1010010110000110100101100001'
   # insert 1 after every 7 bit.
   new_binary='1'.join(binary[i:i+7] for i in range(0, len(binary), 7))
   print(new_binary)
  </code></pre>
  
  <p>my output String:</p>
  
  <blockquote>
    <p>1010010111000011101001011100001</p>
  </blockquote>
  
  <p>Now I want to remove those extra 1 from the output string and get back the Original String. For that I try to identify the position of those 1  I tried the following approach:</p>
  
  <pre><code>binary='1010010111000011101001011100001'
  # remove 1 after every 7 bit.
  for i in range(0, len(binary), 7):
  if((i+7) &lt;len(binary)):
      print("current position = ",i+7, "Value of the position: ", binary[i+7])
      print("\n")
  </code></pre>
  
  <p>and my current output is: </p>
  
  <pre><code>('current position = ', 7, 'Value of the position: ', '1')
  ('current position = ', 14, 'Value of the position: ', '1')
  ('current position = ', 21, 'Value of the position: ', '1')
  ('current position = ', 28, 'Value of the position: ', '0')
  </code></pre>
  
  <p>now from the output, you can see that the first output is OK. But for the 2nd output, 'current position = ' should be 15 instead of 14. and the 3rd output should be 23 instead of 21. And there should be no 4th output. Any help regarding this. please. </p>
  
  <p>N.B: I'm trying to do this for a larger bit string.</p>