Learning python. I’ve doubt on use of following operators:
!= —> Checks if the value of two operands is equal or not, if values are not equal then condition becomes true.
<> —> Checks if the value of two operands is equal or not, if values are not equal then condition becomes true.
The above definition is right(referred from book)? If yes, when we use both operators. Please share your experience with correct situation!!!
From the documentation -
The forms
<>
and!=
are equivalent; for consistency with C,!=
is preferred; where!=
is mentioned below<>
is also accepted. The<>
spelling is considered obsolescent.
(Emphasis mine)
They are equivalent , but you should use !=
. <>
operator is not there in Python 3.x as well.