# Python Increment By 1 ## Introduction

In this post, we are going to learn all the methods for Python Increment By 1. We will see how to increase any variable by 1. This is really simple, we all know but we will still try to cover more and more examples to explain Python Increment By 1.

## Methods to Increment By 1 in Python

### 1. Python Increment By 1 with a simple + operator

Example:

``````x = 5
x = x + 1
print(x)

# Output
# 6``````

### 2. Python Increment By 1 with Increment Shorthand: Augmented Assignment Operator

Example:

``````x = 4
x += 1
print(x)

# Output
# 5``````

### 3. Python Increment By 1 inside while loop

Example:

``````x = 1
while x <= 5:
print(x)
x += 1

# Returns:
# 1
# 2
# 3
# 4
# 5``````

### 4. Python Increment By 1 inside for loop

Example:

``````x = 1
for i in range(5):
print(x)
x += 1

# Returns:
# 1
# 2
# 3
# 4
# 5``````

### 5. Python Increment By 1 with increment operator

Not possible, the increment operator does not exist in Python while it exists in other programming languages like C, C++, Java, etc.

Example:

``````x = 1
x++
print(x)``````

Output:

``````Traceback (most recent call last):
File "F:\thonny-python-programs\Run-python.py", line 2
x++
^
SyntaxError: invalid syntax``````

### 6. Python Increment operator for Strings

``````x = "copy"
y = "assignment"
c = x + y
print(c)

# Returns
# copyassignment``````

## Conclusion

We have learned how can we use Increment or we can say addition operator in Python. We can use this Increment operator in many ways like with other datatypes and built-in data structures like lists, dictionaries, etc. We also saw that we can use this Increment operator to add two strings easily. 