Equality checks whether two objects represent the same value. Identity checks whether two variables point to the same object.

Table of contents
The equality operator in Python
Let's say we have two variables that point to two lists:
>>> a=[2,1,3]>>> b=[2,1,3,4]When we use the == operator to check whether these lists are equal, we'll see that they are not equal:
>>> a==bFalseThese lists don't have the same values right now, so they're not equal.
Let's update the first list so that these two lists do have equivalent values:
>>> a.append(4)>>> a[2, 1, 3, 4]If we use == again, we'll see that these lists are equal now:
>>> a==bTruePython's == operator checks for equality.
Two objects are equal if they represent the same data.
The is operator in Python
Python also has an is …