Asked 3 years ago
21 Jul 2021
Views 615
Ubaldo

Ubaldo posted

Is there a

Is there a "not equal" operator in Python ?
eclipse-learner

eclipse-learner
answered Aug 8 '21 00:00

!= is not equal opearator in Python
!= can used for checking the value is not equal to or not.

!= will returns True or False in Python

print(11!=10)

11!=10 returns True


print(10!=10)

10!=10 returns False

use variables instead of direct value to check whether there are not equal

i=10
j=11
print(i!=j)

it will print True because i and j are not equal and its True



i=10
j=10
print(i!=j)

it will print False because i and j are equal and its False


Post Answer