KnowledgeBoat Logo
|
LoginJOIN NOW

Computer Science

What are augmented assignment operators? How are they useful?

Python Data Handling

34 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

20 Likes


Related Questions