1. Help Center
  2. Python Programming

What does the ‘is’ operator do?

The ‘is’ operator compares the id of the two objects.
 
list1=[1,2,3]

 

list2=[1,2,3]

 

list3=list1

 

list1 == list2 🡪 True

 

list1 is list2 🡪 False

 

list1 is list3 🡪 True