Member-only story
Operators in Python
Python operators are special symbols used to perform specific operations on one or more operands. The variables, values or expressions can be used as operands. For example, Python’s addition operator (+) is used to perform addition operations on two variables, values or expressions.
They are divided into several categories.
Arithmetic Operators
These operators are used to perform mathematical operations.
+: Addition-: Subtraction*: Multiplication/: Division%: Modulus**: Exponentiation//: Floor division
a = 11
b = 4
print(a + b) # Output: 15
print(a - b) # Output: 7
print(a * b) # Output: 44
print(a / b) # Output: 2.75
print(a % b) # Output: 3
print(a ** b) # Output: 14641
print(a // b) # Output: 2Comparison (Relational) Operators
These operators compare two values and return a Boolean result (True or False).
==: Equal to!=: Not equal to>: Greater than<: Less than>=: Greater than or equal to<=: Less than or equal to
x = 5
y = 10
print(x == y) # Output: False
print(x != y) # Output: True
print(x > y) # Output: False
print(x < y)…





