May 2017
Intermediate to advanced
280 pages
6h 2m
English
Given in the table are the two identity operators:
|
Operator |
Description |
|
is |
Returns True if two variables point to the same object and False, otherwise |
|
is not |
Returns False if two variables point to the same object and True, otherwise |
The following screenshot shows that the value can be same but id can be different. It returns True if id is the same:

Here, as both x and y contain the same value (10), id() returns the same value for both. However, when x and y are provided with the same list, id() returns different values. This could be attributed to the fact that when x and y have 10 assigned to them, ...
Read now
Unlock full access