GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.geeksforgeeks.org — Python Operators - GeeksforGeeks Python OperatorsLast Updated : 21 Oct, 2026 In Python programming, Operators in general are used to perform operations on values and variables.
Types of Operators in Python![]() Arithmetic OperatorsArithmetic operators are used to perform basic mathematical operations like addition, subtraction, multiplication and division. In Python, the division operator (/) returns a floating-point result, while floor division (//) returns an integer result.
Output Addition: 19 Subtraction: 11 Multiplication: 60 Division: 3.75 Floor Division: 3 Modulus: 3 Exponentiation: 50625
Comparison OperatorsComparison(or Relational) operators compares values. It either returns True or False according to the condition.
Output False True False True False True Logical OperatorsLogical operators perform Logical AND, Logical OR and Logical NOT operations. It is used to combine conditional statements. The precedence of Logical Operators in Python is as follows:
Output False True False Bitwise OperatorsBitwise operators act on bits and perform bit-by-bit operations. These are used to operate on binary numbers. Bitwise Operators in Python are as follows:
Output 0 14 -11 14 2 40 Assignment OperatorsAssignment operators are used to assign values to the variables. This operator is used to assign the value of the right side of the expression to the left side operand. Example:
Output 10 20 10 100 102400 Identity Operators"is" and "is not" are the identity operators and both are used to check if two values are located on the same part of the memory. Two variables that are equal do not imply that they are identical.
Output True True Membership Operators"in" and "not in" are the membership operators that are used to test whether a value or variable is in a sequence.
Output x is NOT present in given list y is present in given list Ternary OperatorTernary operators also known as conditional expressions are operators that evaluate something based on a condition being true or false. It was added to Python in version 2.5. It simply allows testing a condition in a single line replacing the multiline if-else, making the code compact.
Output 10 Precedence and Associativity of OperatorsOperator precedence and associativity determine the priorities of the operator. Operator PrecedenceThis is used in an expression with more than one operator with different precedence to determine which operation to perform first.
Output 610 Hello! Welcome. Operator AssociativityIf an expression contains two or more operators with the same precedence then Operator Associativity is used to determine. It can either be Left to Right or from Right to Left.
Output 100.0 6 0 512 Comment Explore |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |