- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
The != operator in Python stands for "not equal to."
If the operands on either side are not equal, it returns True; if they are, it returns False. Python is dynamically, but strongly typed, and other statically typed languages would traceback or would give error about comparing different types. So, if tow variables have the same values but they are of different type, then not equal operator will return True.
Example-
1) 5 == 5 --> True
4 != 5 --> False
2) str = 'hey'
if str == 'hey': # equalelif str != 'hey': # not equal
Comments
Post a Comment