How does ++ and -- operators work in Python?

PythonServer Side ProgrammingProgramming

In C, C++, Java etc ++ and -- operators increment and decrement value of a variable by 1. In Python these operators won't work. 

In Python variables are just labels to objects in memory. In Python numeric objects are immutable. Hence by a++ (if a=10) we are trying to increment value of 10 object to 11 which is not allowed.

>>> a=10
>>> a++
SyntaxError: invalid syntax

Instead we have to use += operator

>>> a=a+1
>>> a
Published on 10-Feb-2018 12:56:58