Learn how Python performs operations on variables and values
Operators are special symbols or keywords in Python used to perform operations on values or variables.
+ Addition- Subtraction* Multiplication/ Division% Modulus// Floor Division** Exponentiation# Example
a = 10
b = 3
print(a + b) # 13
print(a ** b) # 1000
== Equal!= Not equal> Greater than< Less than>= Greater or equal<= Less or equal# Example
x = 5
y = 10
print(x != y) # True
print(x < y) # True
= Assign+=, -=, *=, /= etc.# Example
n = 5
n += 3 # n = n + 3
print(n) # 8
andornot# Example
a = True
b = False
print(a and b) # False
print(not b) # True
is – True if objects are sameis not – True if not same# Example
x = [1,2]
y = x
print(x is y) # True
innot in# Example
colors = ["red", "blue"]
print("red" in colors) # True
& AND| OR^ XOR~ NOT<<, >> Shift left/right# Example
a = 5 # 0101
b = 3 # 0011
print(a & b) # 1