Python - Looping through a string pulling 1 character at a time and then 2
<p>Problem:</p>

<p>I have a string of numbers, lets call it strNumbers. I need to go through this string, character by character doing calculations on each number up until a certain point. At that point, I need to start pulling two of the numbers at a time and doing calculations on those two numbers. Here's what I have come up with thus far, as you can see I have figured out how to iterate through the loop pulling single characters no problem. I also understand that I need a counter to determine exactly when I need to start pulling two characters at a time, but now what? Any help is appreciated, thank you.</p>

<pre><code>for i in strNumbers:    
    intNumber = int (i)
    **do math on intNumber*
    **print result**
    count = count +1
    if count == 5:
        ??
</code></pre>

<p>Edit:
I've decided to use two separate loops to accomplish this task, I've encountered another issue however. The following code throws a, TypeError: Can't convert 'int' object to str implicitly at line, number = int(strTail[i:i+2])</p>

<pre><code>for i in strTail:
    number = int(strTail[i:i+2])
    intRooted = int( math.sqrt(number))
    strDecoded += str(intRooted)
</code></pre>

<p>Logically this seems like exactly what I want to do, I put to pull the number at position 'i' and the number one position ahead of i. What am I missing here?</p>
