What is the difference between "==" and "is" in python?
author
,
Fond of IT

In python "is" vs "==" please explain.

  • Total 1 Answer
  • 28
Can You answer this question?
author
,
Fond of IT

In python == checks equality of the value but "is" checks memory. You can refer to below example to understand it better:

a = [1,2,3]

b = [1,2,3]

a == b

returns true because all values are same in both the lists.

a is b

returns false because a and b are two different objects in memory.

clone = b

b is clone

returns true because clone and b point to the same memory.

I hope you understand now the difference between "==" and "is" in python.