Skip to content
Advertisement

Is there a “not equal” operator in Python?

How would you say does not equal?

Like

JavaScript

Is there something equivalent to == that means “not equal”?

Advertisement

Answer

Use !=. See comparison operators. For comparing object identities, you can use the keyword is and its negation is not.

e.g.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement