Yes, there a “not equal” operator in Python which is denoted by !=, if you want to compare object identity, you can use the keyword is and its negation is not.
Below is your code with the != operator:-
answer = 'hi'
if answer == 'hi':
print("hi")
elif answer != 'hi':
print("no hi")
To know more about this you can have a look at the following video tutorial:-