Say you have:
text = "22 + 33"
And you want to verify that the sign used it is actually an addition sign:
for word in text:
If word == "+":
- How do I find the index/position of the addition sign inside the string?
- How do you find the index/position of the numbers to the sides of the addition sign?
I want to do this to then assign these values to variables and then be able to calculate the problem.
PD: The problem is that, the string is not only going to have the addition and thats it, it will contain much more words and signs. Plus, it will be constantly updating (every 0.5 secs). Thats why I want to locate if there is an ADDITION sign and then find the two numbers to its sides to consecuently calculate the sum. Therefore, following my approach, I should need the indexes of the the three things; number1, addition sign and number 2.