flâneur — a map of the web's best reading

Augmented Assignment Operators in Python - GeeksforGeeks

geeksforgeeks.org · 1,074 words · saved by 1 readers

An assignment operator is an operator that is used to assign some value to a variable. Like normally in Python, we write “a = 5“ to assign value 5 to variable ‘a’. Augmented assignment operators have a special role to play in Python programming. It basically combines the functioning of the arithmetic or bitwise operator with the assignment operator. So assume if we need to add 7 to a variable “a” and assign the result back to “a”, then instead of writing normally as “a = a + 7“, we can use the augmented assignment operator and write the expression as “a += 7“. Here += has combined the functionality of arithmetic addition and assignment. So, augmented assignment operators provide a short way to perform a binary operation and assigning results back to one of the operands. The way to write an augmented operator is just to write that binary operator and assignment operator together. In Python, we have several different augmented assignment operators like +=, -=, *=, /=, //=, **=, |=, &=, >

Augmented Assignment Operators in Python - GeeksforGeeks Courses Tutorials Interview Prep Python Tutorial Data Types Interview Questions Examples Quizzes DSA Python Data Science NumPy Pandas Practice Django Flask Augmented Assignment Operators in Python Last Updated : 7 Sep, 2021 An assignment operator is an operator that is used to assign some value to a variable. Like normally in Python, we write " a = 5 " to assign value 5 to variable 'a'. Augmented assignment operators have a special role to play in Python programming. It basically combines the functioning of the arithmetic or bitwise oper

Explore this link on the map →

related reading