[Solved] python converting string to int and adding 1 [closed]


You are clearly not doing what you say you are doing:

>>> x = '8'
>>> y = '7'
>>> x+y
'87'
>>> x = int(x)
>>> y = int(y)
>>> x+y
15

Use + on strings and you get concatenation. Use + on integers and you get addition. If you are getting concatenation then you must be operating on strings rather than integers.

solved python converting string to int and adding 1 [closed]