Tags
python
Asked 2 years ago
5 Aug 2021
Views 247
Gwen

Gwen posted

What does a != Mean in Python ?

what is use of != in Python ?
i know != means not equal to condition check but not sure how to use != in Python ?
QuickIos

QuickIos
answered Aug 8 '21 00:00

!= is means not equal to
!= is used to check wheater two value is equal or not
!= will returns True or False

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