'''
Created on Apr 21, 2021
Python Assignment Operators
Operator Example Same As
= x = 5 x = 5
+= x += 3 x = x + 3
-= x -= 3 x = x - 3
*= x *= 3 x = x * 3
/= x /= 3 x = x / 3
%= x %= 3 x = x % 3
//= x //= 3 x = x // 3
**= x **= 3 x = x ** 3
&= x &= 3 x = x & 3
|= x |= 3 x = x | 3
^= x ^= 3 x = x ^ 3
>>= x >>= 3 x = x >> 3
<<= x <<= 3 x = x << 3
@author: hp
'''
print("Python Assignment Operators are ")
print("1st operator = (equal to)")
a=10
print("Result is :",a)
print("\n")
print("2nd operator +=")
b=20
b+=3
print("Result is :",b)
print("\n")
print("3rd operator -=")
b=20
b-=3
print("Result is :",b)
print("\n")
print("4th operator *=")
b=20
b*=3
print("Result is :",b)
print("\n")
print("5th operator /=")
b=20
b/=3
print("Result is :",b)
print("\n")
print("6th operator %= ")
b=20
b%=3
print("Result is :",b)
print("\n")
print("7th operator //=")
x = 5
x//=3
print("Result is :",x)
print("\n")
print("8th operator **=")
x = 5
x **= 3
print("Result is :", x )
Comments
Post a Comment