Linux serverNETWORK ADMINISTRATIONSredhat

What are the Python Operators & their explanation Part 01 : Beginners class – 04

Python, operators are special symbols or keywords that are used to perform operations on variables and values. Python supports a variety of operators, which can be categorized into different types:
1. Arithmetic Operators:
Addition: Adds two operands.
Subtraction: Subtracts the right operand from the left operand.
Multiplication: Multiplies two operands.
Division: Divides the left operand by the right operand.
Floor Division: Performs floor division on the operands.
Modulus: Returns the remainder of the division of the left operand by the right operand.
Exponentiation: Raises the left operand to the power of the right operand.
2. Assignment Operators:
Assign: Assigns the value on the right to the variable on the left.
Add and Assign: Adds the right operand to the left operand and assigns the result to the left operand.
Subtract and Assign: Subtracts the right operand from the left operand and assigns the result to the left operand.
Multiply and Assign: Multiplies the left operand by the right operand and assigns the result to the left operand.
Divide and Assign: Divides the left operand by the right operand and assigns the result to the left operand.
Floor Divide and Assign: Performs floor division on the left operand by the right operand and assigns the result to the left operand.
Modulus and Assign: Computes the modulus of the left operand divided by the right operand and assigns the result to the left operand.
Exponentiate and Assign: Raises the left operand to the power of the right operand and assigns the result to the left operand.
3. Comparison Operators:
Equal to: True if both operands are equal.
Not equal to: True if operands are not equal.
Less than: True if the left operand is less than the right operand.
Greater than: True if the left operand is greater than the right operand.
Less than or equal to: True if the left operand is less than or equal to the right operand.
Greater than or equal to: True if the left operand is greater than or equal to the right operand.
4. Logical Operators:
and Logical AND: True if both operands are true.
OR True if at least one of the operands is true.
not Logical NOT: True if the operand is false complements the operand.
5. Identity Operators:
is Identity: True if both operands refer to the same object.
is not Not Identity: True if both operands do not refer to the same object.
6. Membership Operators:
in: True if a value is found in the sequence.
not in: True if a value is not found in the sequence.
7. Bitwise Operators:
Bitwise AND: Performs bitwise AND on the binary representations of the operands.
Bitwise OR: Performs bitwise OR on the binary representations of the operands.
Bitwise XOR: Performs bitwise XOR on the binary representations of the operands.
Inverts the bits of the operand.
Shifts the bits of the left operand to the left by the number of positions specified by the right operand.
Shifts the bits of the left operand to the right by the number of positions specified by the right operand.

Ayesha Akter Chandni
Instructor of Computer Science and Engineering
B.Sc(CSE),M.Sc(CSE)
CCNA, CCNP, RHCSA, RHCE, RHCVA,
RedHat OpenStack-200,
Server Security & Hardening -413.

#code #Python #Operators

source

by Hello IT World

redhat openstack