0% found this document useful (0 votes)
12 views

Augmented Assignment Operator

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Augmented Assignment Operator

Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

ASSIGNMENT

OPERATOR

It is denoted by the “=“ symbol, is the


operator that is used to assign values to
variables in Python
ATTRIBUTE
 * Python attributes are variables of a class that are shared
between all of its instances.
 * Every object we create for the class has access to the
variables in the class. These variables are called
attributes.
AUGMENTED ASSIGNMENT
OPERATORS

 * Augmented assignment operators have a special roll to


play in Python programming.
 * It basically combines the functioning of the arithmetic
with the assignment operator.
 * Augmented assignment operators provide a short way
to perform a binary operation and assigning results back
one of the operands.
EXAMPLES:
 1. Addition and Assignment (+=): This operator
combines the impact of arithmetic addition and
assignment. Here
 a = a + b can be written as a += b

 a = 15

 b = 20

 a += b

 Print ( a ), the output will be 35


EXAMPLES:
 1. Subtraction and Assignment (- =): This operator
combines the impact of arithmetic subtraction and
assignment. Here
 a = a - b can be written as a - = b

 a = 80

 b = 20

a-=b

 Print ( a ), the output will be 60


EXAMPLES:
 1. Multiplication and Assignment (* =): This operator
combines the functionality of multiplication and
assignment. Here
 a = a * b can be written as a * = b

 a = 13

 b = 21

a*=b

 Print ( a ), the output will be 273


EXAMPLES:
 1. Division and Assignment (/ =): This operator
combines the functionality of division and assignment.
Here
 a = a / b can be written as a / = b

 a = 52

b=4

a/=b

 Print ( a ), the output will be 13

You might also like