Objective
The is operator checks identity (is it the same object?) and == checks equality (do they have the same value?). A copy is equal to the original, but it is not the same object.
Instructions
- Write a program that creates
a = [1, 2, 3], thenb = aandc = list(a). - Show three lines:
sameordifferentdepending on whetherais the same object asb;sameordifferentdepending on whetherais the same object asc; andequalordifferentdepending on whetherahas the same value asc.
same
different
equal
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise