Python TutorialPython OperatorsIntroduction to Python OperatorsPython OperatorsOperators are symbols or special characters that perform operations on operands (values or variables). Python provides a wide range of operators that can be used for various purposes, such as mathematical calculations, logical comparisons, assignment, membership testing, and more. Here are some of the commonly used operators in Python:Arithmetic Operators+ : Addition- : Subtraction* : Multiplication/ : Division (returns a float)// : Floor Division (returns an integer)% : Modulo (returns the remainder of division)** : Exponentiation (raises a number to a power)x = 10y = 3print(x + y) # Output: 13print(x - y) # Output: 7print(x * y) # Output: 30print(x / y) # Output: 3.3333333333333335print(x // y) # Output: 3print(x % y) # Output: 1print(x ** y) # Output: 1000Assignment Operators= : Assigns a value to a variable+= : Adds the right operand to the left operand and assigns the result to the left operand-= : Subtracts the right operand from the left operand and assigns the result to the left operand*= : Multiplies the right operand with the left operand and assigns the result to the left operand/= : Divides the left operand by the right operand and assigns the result to the left operand//= : Performs floor division on the left operand by the right operand and assigns the result to the left operand%= : Calculates the modulus of the left operand with the right operand and assigns the result to the left operand**= : Performs exponentiation on the left operand with the right operand and assigns the result to the left operandx = 10y = 3x += y # Equivalent to x = x + yprint(x) # Output: 13x -= y # Equivalent to x = x - yprint(x) # Output: 10x *= y # Equivalent to x = x * yprint(x) # Output: 30x /= y # Equivalent to x = x / yprint(x) # Output: 10.0x //= y # Equivalent to x = x // yprint(x) # Output: 3.0x %= y # Equivalent to x = x % yprint(x) # Output: 0.0x **= y # Equivalent to x = x ** yprint(x) # Output: 0.0Comparison Operators== : Equal to!= : Not equal to> : Greater than< : Less than>= : Greater than or equal to<= : Less than or equal tox = 5y = 10print(x == y) # Output: Falseprint(x != y) # Output: Trueprint(x > y) # Output: Falseprint(x < y) # Output: Trueprint(x >= y) # Output: Falseprint(x <= y) # Output: TrueLogical Operatorsand : Returns True if both operands are Trueor : Returns True if at least one of the operands is Truenot : Returns the opposite Boolean value of the operandx = 5y = 10z = 7print(x < y and z > x) # Output: Trueprint(x > y or z > x) # Output: Trueprint(not (x > y)) # Output: TrueMembership Operatorsin : Returns True if a value is found in a sequencenot in : Returns True if a value is not found in a sequencefruits = ["apple", "banana", "orange"]print("apple" in fruits) # Output: Trueprint("kiwi" not in fruits) # Output: True