two objects (say a and b) when compared using ==, return true but Python gives false when compared using is operator why? (i.e., a==b is true but why is a is b false
Attachments:
Answers
Answered by
12
Answer:
It shows “False” because two variables are at different memory locations. that's why it returns false
Explanation:
hope it will help
Answered by
2
Answer:
This is because a and b both have the same value but their addresses are different i.e. they refer to different memory locations.
Similar questions