Home >Backend Development >Python Tutorial >python program language operators
python divides the operators in the following groups
Types of operators
Arithmetic operators
Assignment operators
comparison operators
logical operators
bitwise operators
Membership operators
program
The Arithmetic operators is numeric value is mathematical operators
1.Addition
2.Subtraction
3.Multlplication
4.Division
5.Modules
6.Floor division
a=3
b=2
print(a + b)
O/P
5
a=6
b=5
print(a-b)
O/P
1
a=25
b=25
print(a*b)
O/P
500
a=12
b=3
print(a/b)
O/P
4
a=5
b=2
print(a % b)
O/P
1
a=15
b=2
print(a//b)
O/P
7
2.Assignment operators
The assignment operators is a assign value to varables
a=4
print(a)
o/p
4
x=2
x+=2
print(x)
o/p
4
x=2
x-=2
print(x)
o/p
0
x=6
x*=2
print(x)
o/p
12
x=6
x/=3
print(x)
o/p
2.0
x=9
x%=4
print(x)
o/p
1
x=5
x//=2
print(x)
o/p
2
x=8
x&=3
print(x)
o/
0
x=7
x^=8
print(x)
o/p
15
x=5
x!=3
print(x)
o/p
5
x=9
x>>=4
print(x)
o/p
0
x=9
x<<=4
pr9int(x)
o/p
144
3.Comparsion operators
The Comparsion operatror is compare two values
x=3
y=6
print(x==y)
false
x=3
y=6
print(x!=y)
o/p
True
x=3
y=6
print(x>=y)
o/p
true
x=3
y=6
print(x<=y)
o/p
false
4.logical oiperators
AND
OR
NOT
X=5
print(x>3 and x<10)
o/p
true
x-5
print(x>3 or x<4)
o/p
true
x=5
print(x>3 not x<10))
o/p
false
The above is the detailed content of python program language operators. For more information, please follow other related articles on the PHP Chinese website!