title: Algorithm for this sequence in python function
body: <p>Write a function named q1() that accepts one (1) parameter, a String which you can assume will always
  contain a sequence of only digits and should evaluate the String as if it loops around infinitely end-to-end.
  The purpose of the q1() function is to verify that for every digit n in the String, there are never
  more than n other digits in between recurring values. (i.e., there are no more than two digits between
  each occurrence of 2, three digits between each 3, four digits between each 4, etc..) If this is the case,
  the function should return <code>True</code>, otherwise it should return <code>False</code>.</p>
  
  <p>For example, consider the String: '32423'
  The first digit is 3, and there are only three other values in between the occurrences of the digit 3. The
  second digit is 2, and are there are never more than two other values in between occurrences of the digit 2.
  The third digit is 4; it isn’t duplicated.  However if you view the String as looping infinitely, you will find that
  only four other values are passed before looping back to the digit 4 again. </p>
  
  <p>For this example, the q1()
  function would return <code>True</code></p>
  
  <pre><code>def q1(nostring):
  for i in range(len(nostring)):
      count=0
      for j in range(i+1,len(nostring)):
          if nostring[i]!=nostring[j]:
              count+=1
          else:
              break
      if count &gt; eval(nostring[i]):
          return False
  else:
      return True
  </code></pre>
  
  <p>This code gives fine output in every test case except '235234'
  It should return False
  It gives out True instead</p>
  
  <p>I came up with this so far and it doesn't work
  I have been having a really hard time figuring the out how to make it work</p>