Post

@PythonPr Answer: 125
Solution: `a` is a string, ie, a sequence of characters.
It has the characters 1, 2, and 3.
These are digits, but `a` is still not treated as a number.
For python to treat it as a number, it needs to be converted to a numeric type.
That is exactly what
+
English

@PythonPr int(a) does.
It converts the string `a` into an int.
So, "123" is converted by int into the integer 123.
Then we add 2 to it, making the answer 125.
That is what gets printed.
English

@PythonPr A common practical use case is when you use `input` function to get the user's input.
The value coming from the input function is always a string, even if the user enters a number.
So, it has to be converted to an integer before processing, using the int function.
English
