Python Operators
Arithmetic Operators
print(10+3) 13print(10-2) 8
print(10*3) 30
print(10/3) 3.3333333333333335
this ( / ) operator will always return a floating value
print(10/2) 5i.0
print(10//3) 3
and this ( // ) will return an integer value
print(10//2) 5
print(10%3) 1
print(10**3) 1000
this ( ** ) operator is power of operator.
Assignment operators
x==3
Following are augmented or enhanced assignment operators
x+=3
x*=3
x/=3
x//=3
x%=3
Operator precedence
Parenthesis
Exponantiation or power
multiplication
division / or // <<<doubt which first
modulus
addition
subtraction
Comments
Post a Comment