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
If you give the following for str1 = "Hello", why does Python report error?
str1[2] = 'p'
What will the result given by the following?
(a) type (6 + 3)
(b) type (6 -3)
(c) type (6 *3)
(d) type (6 / 3)
(e) type (6 // 3)
(f) type (6 % 3)
Differentiate between (555/222)**2 and (555.0/222)**2.
Given three Boolean variables a, b, c as : a = False, b = True, c = False. Evaluate the following Boolean expressions:
(a) b and c
(b) b or c
(c) not a and b
(d) (a and b) or not c
(e) not b and not (a or c)
(f) not ((not b or not a) and c) or a