KnowledgeBoat Logo

Computer Science

What are augmented assignment operators? How are they useful?

Python Data Handling

33 Likes

Answer

Augmented assignment operators combine the impact of an arithmetic operator with an assignment operator. For example, to add the value of b to the value of a and assign the result back to a then instead of writing:

a = a + b

we can write

a += b.

Augmented assignment operators are useful as they provide a shorthand way by combining the arithmetic and assignment operators.

Answered By

19 Likes


Related Questions