If you’re familiar with Python, you would have known Increment and Decrement operators ( both pre and post) are not allowed in it.
Python is designed to be consistent and readable. One common error by a novice programmer in languages with ++ and -- operators is mixing up the differences (both in precedence and in return value) between pre and post increment/decrement operators. Simple increment and decrement operators aren’t needed as much as in other languages.
You don’t write things like :
python - Sample - python code :
In Python, instead we write it like
Output:
We can almost always avoid use of ++ and --. For example, x++ can be written as x += 1 and x-- can be written as x -= 1.