Augmented Assignment Operators In Python
In this tutorial, we’ll learn about augmented assignment operators in Python. We’ll try to understand these operators with practical Python code examples to better understand their role in Python.
Introduction: Augmented Assignment Operators In Python
As you may already know that assignment(=) operator is used to assign values. If we just use assignment operator then it’ll be a simple operator. But when we combine it with an arithmetic operator, then it becomes an augmented assignment operator. Click here if you want to learn Python arithmetic operators in detail.
Augmented operator is very beneficial to make the code look more professional by removing extra code.
Get Zeeshan Ali’s stories in your inbox
Join Medium for free to get updates from this writer.
In order to understand augmented operators, we first have to understand assignment operator. Let’s now understand it with practical Python code examples.
Simple Assignment Operator(=)
Let’s first go through a simple Python assignment operator. See below example:
Example: Assigning Values
value=50
print(value)
value=20
print(value)Output
50
20In the above example, we’ve created a variable and have assigned an integer value to it. After that, we’ve given it a value 20. As we can see in the above output that value 50 is replaced by 20. Let’s say we want to add the new value to the existing value. In order to do that, we’ve to follow the below code: Continue reading…





