Use !=. See comparison operators. For comparing object identities, you can use the keyword is and its negation is not.
e.g.
1 == 1 # -> True
1 != 1 # -> False
[] is [] #-> False (distinct objects)
a = b = []; a is b # -> True (same object)
Not equal != (vs equal ==)
Are you asking about something like this?
answer = ‘hi’
if answer == ‘hi’: # equal
print “hi”
elif answer != ‘hi’: # not equal
print “no hi”
This Python – Basic Operators chart might be helpful.