Glossary
HTML
CSS
JavaScript
Python

PYTHON

Inequality operator in PYTHON

To check if a number isn't equal to another number, we use the inequality operator, !=.

Python

print(1 != 10)

 

 

We can store the result of a comparison with the inequality operator in a variable like here where we'll store the comparison 1 != 2.

Python

result = 1 != 2
print(result)

 

 

To check if a string isn't equal to another string, we use the inequality operator, !=.

Python

print("subscribed" != "rejected")
Learn to Code in Python for Free
Start learning now
To advance beyond this tutorial and learn Python by doing, try the interactive experience of Mimo. Whether you're starting from scratch or brushing up your coding skills, Mimo helps you take your coding journey above and beyond.

Sign up or download Mimo from the App Store or Google Play to enhance your programming skills and prepare for a career in tech.

You can code, too.

© 2023 Mimo GmbH