Increment/Decrement operators in Python

Since this post exists, you might be fairly certain that there must be some difference between the increment operators (++ i and i ++) and decrement operators (i-and-i).

Apparently, Python doesn’t like to have multiple ways to do the same thing.

Alternatively, you can use:

count = 0

#Increment
count += 1

#Decrement
count -= 1

In the end, the operators ++ and–are just “shortcuts ” to + = 1 and-1 =.

The following two tabs change content below.
Software Architect and Backend Developer (almost Fullstack), I usually work with C#, PowerShell, Python, Golang, bash and Unity (this one is more for a hobby). I'm always looking for something new to learn, adding new tools to my utility belt.
Posted in Dev, Python and tagged , , , , .