Computer Science, asked by GokulDG1930, 1 year ago

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 charlie1505
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 kripa1048
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