Table of Contents
show
- Assignment operators are used to assign values to variables
- Consider a=2, b= 3, c= 4
Example
a=3
b=2
c=a+b
print("c=",c)
a+=b
print("a+=b",a)
a-=b
print("a-=b",a)
a*=b
print("a*=b",a)
a/=b
print("a/=b",a)
a%=b
print("a%=b",a)
a**=b
print("a**=b",a)
a//=b
print("a//=b",a)
Output
('c=', 5)
('a+=b', 5)
('a-=b', 3)
('a*=b', 6)
('a/=b', 3)
('a%=b', 1)
('a**=b', 1)
('a//=b', 0)
Views: 2