Problem:
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.
for i in strNumbers:
intNumber = int (i)
**do math on intNumber*
**print result**
count = count +1
if count == 5:
??
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])
for i in strTail:
number = int(strTail[i:i+2])
intRooted = int( math.sqrt(number))
strDecoded += str(intRooted)
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?