Identity comparison (is): This checks whether two variables reference the same object in memory. In other words, it tests if the two variables are pointing to the exact same location in the computer's memory.
Ex.-
a = [1, 2, 3]
b = [1, 2, 3]
print(a is b) # This will be False
In this example, a and b are two different objects in memory, even though they happen to have the same content.
Equality comparison (==): This checks whether the values of two variables are equal, regardless of whether they reference the same object in memory.
Ex.-
a = [1, 2, 3]
b = [1, 2, 3]
print(a == b) # This will be True
Here, the comparison using == checks if the elements of the lists are the same, and since they are, the result is True.
Please join telegram channel...
https://t.me/dev19community
Please follow us
/ dev19community
Thanks for watching us ...
Dev19🖤
На этой странице сайта вы можете посмотреть видео онлайн Python Questions Series - 14 | длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь DEV19 18 Январь 2024, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 90 раз и оно понравилось 12 зрителям. Приятного просмотра!