Q:

How do you use "not equal" in Python?

A:

Quick Answer

The syntax for the "not equal" operator is != in the Python programming language. This operator is most often used in the test condition of an "if" or "while" statement.

Continue Reading

Full Answer

The test condition a != b returns false if a is equal to b, or true if a is not equal to b. A programmer can use this expression in the statement if(a != b) followed by an indented block of code, in which case the indented code block is only executed if a is not equal to b. In older versions of Python, the "not equal" operator could also be written as <>.

Learn more about Arithmetic
Sources:

Related Questions

Explore