Traverse the equation
for j in range ( 0 , n ) : NEW_LINE INDENT if ( equation [ j ] == ' + ' or equation [ j ] == ' - ' ) : NEW_LINE INDENT if ( j > i ) : NEW_LINE INDENT total = ( total + sign * int ( equation [ i : j ] ) ) NEW_LINE DEDENT i = j NEW_LINE DEDENT DEDENT