Difference between == and is operator in Python Last Updated : 04 Apr, 2025 Comments Improve Suggest changes Like Article Like Report In Python, == and is operators are both used for comparison but they serve different purposes. The == operator checks for equality of values which means it evaluates whether the values of two objects are the same. On the other hand, is operator checks for identity, meaning it determines whether two variables point to the same object in memory.== OperatorTo compare objects based on their values, Python's equality operators (==) are employed. It calls the left object's __eq__() class method which specifies the criteria for determining equality. However, these constraints are typically written so that the equality operator == returns True if two objects, have the same value and returns False if both have different value. Python x = [1, 2, 3] y = [1, 2, 3] z = x # Equality comparison (==) if x == y: print("True") else: print("False") Explanation:x == y checks if both lists have the same values. Since both lists contain [1, 2, 3], the output will be True.‘is’ OperatorPython identity operators (is, is not) are used to compare objects based on their identity. When the variables on either side of an operator point at the exact same object, the "is" operator's evaluation is true. Otherwise, it would provide us with a false assessment.Code Example of == operator and ‘is’ Operator : Python x = [1, 2, 3] y = [1, 2, 3] z = x # Case 1: Identity comparison (is) if x is y: print("True") else: print("False") # Case 2: Comparing references (is) if x is z: print("True") else: print("False") OutputFalse True Explanation:Case 1: x is y checks if x and y refer to the same object in memory. Since x and y are two separate list objects, the output will be False.Case 2: x is z checks if x and z refer to the same object. Since z is assigned to x, they are the same object, and the output will be True.Comparison:Parametersis Operator== OperatorNameThe ‘is’ is known as the identity operator.The ‘==’ is known as the equality operator.UsesThe is operator checks if two variables point to the same object in memory. It returns True if both variables are referring to the exact same object. If they point to different objects, even if the values are the same, it returns False.When the variables on either side have the exact same value, the == operator evaluation is true. Otherwise, it will evaluate as False. Comment More infoAdvertise with us Next Article Difference between == and is operator in Python K Kuldip Kumar 1 Follow Improve Article Tags : Python python-basics Practice Tags : python Similar Reads Python Operators In Python programming, Operators in general are used to perform operations on values and variables. These are standard symbols used for logical and arithmetic operations. In this article, we will look into different types of Python operators. OPERATORS: These are the special symbols. Eg- + , * , /, 6 min read Precedence and Associativity of Operators in Python In Python, operators have different levels of precedence, which determine the order in which they are evaluated. When multiple operators are present in an expression, the ones with higher precedence are evaluated first. In the case of operators with the same precedence, their associativity comes int 4 min read Python Arithmetic OperatorsPython Arithmetic Operators Python operators are fundamental for performing mathematical calculations. Arithmetic operators are symbols used to perform mathematical operations on numerical values. Arithmetic operators include addition (+), subtraction (-), multiplication (*), division (/), and modulus (%). OperatorDescriptionS 4 min read Difference between / vs. // operator in Python In Python, both / and // are used for division, but they behave quite differently. Let's dive into what they do and how they differ with simple examples./ Operator (True Division)The / operator performs true division.It always returns a floating-point number (even if the result is a whole number).It 2 min read Python - Star or Asterisk operator ( * ) The asterisk (*) operator in Python is a versatile tool used in various contexts. It is commonly used for multiplication, unpacking iterables, defining variable-length arguments in functions, and more.Uses of the asterisk ( * ) operator in PythonMultiplicationIn Multiplication, we multiply two numbe 3 min read What does the Double Star operator mean in Python? The ** (double star)operator in Python is used for exponentiation. It raises the number on the left to the power of the number on the right. For example:2 ** 3 returns 8 (since 2³ = 8)It is one of the Arithmetic Operator (Like +, -, *, **, /, //, %) in Python and is also known as Power Operator.Prec 2 min read Division Operators in Python Division Operators allow you to divide two numbers and return a quotient, i.e., the first number or number at the left is divided by the second number or number at the right and returns the quotient. There are two types of division operators: Float divisionInteger division( Floor division)When an in 5 min read Modulo operator (%) in Python Modulo operator (%) in Python gives the remainder when one number is divided by another. Python allows both integers and floats as operands, unlike some other languages. It follows the Euclidean division rule, meaning the remainder always has the same sign as the divisor. It is used in finding even/ 4 min read Python Logical Operators Like