How to Increment in Python
![how to increment in python](https://pythonpoint.net/wp-content/uploads/2020/12/how-to-increment-in-python-1024x576.jpg)
Python does not have any built-in increment(both pre and post) operator like any other programming languages.
In Python, you can increase the value of a variable by 1
using the augmented assignment operators. The code value += 1
increments the numeric values in value
by 1
.
>>> 34 34 >>> 34++ File "<stdin>", line 1 34++ ^ SyntaxError: invalid syntax >>> ++34 34 >>> value = 34 >>> value ++ File "<stdin>", line 1 value ++ ^ SyntaxError: invalid syntax >>>value +=1 >>>value 35
Subscribe
Login
Please login to comment
0 Discussion