Does Python support ++?
python
Solution
No:
In [1]: a=1
In [2]: a++
------------------------------------------------------------
File "<ipython console>", line 1
a++
^
SyntaxError: invalid syntax
But you can:
In [3]: a+=1
In [4]: a
Out[4]: 2
Problem
Possible Duplicate: Behaviour of increment and decrement operators in Python I'm new to Python, I'm confused about ++ python. I've tried to ++num but num's value is not changed: ``` >>> a = 1 >>> ++a 1 >>> print a 1 >>> print(++a) 1 ``` Could somebody explain this? If Python support ++, why num has not changed. If it doesn't why can I use ++?