Skip to content

Files

Latest commit

feb35b0 · Jun 7, 2017

History

History
31 lines (29 loc) · 1.09 KB

File metadata and controls

31 lines (29 loc) · 1.09 KB

Python is not Operator

Python's is not operator tests for negative object identity, or whether two different variables are pointing to different objects.
In other words, the statement 'x is not y' is true if and only if x and y are not the same object. Object identity is determined using the id() function.
This is different from the inequality operator (!=), which compares two values and returns False if they're equivalent or True if they are not.

>>> a = 1
>>> b = 1
>>> c = 1.0
>>> id(a)
4363379264
>>> id(b)
4363379264
>>> id(c)
4364861632
>>> a is not b
False
>>> a is not c
True
>>> b is not c
True

Instructions:
In the console, there is a function named negative_identity_test that contains an if-else statement.
Fill in the missing code in the 'if' clause that will make the function run properly.