Home > Article > Backend Development > How to express "not equal" in python
How to express not equal in python?
Recommended manual:Basic introductory tutorial on Python
Python is not equal to the Python comparison operator !=. != means not equal, used to compare whether two objects are not equal.
Assume variable a is 10 and variable b is 20: (a != b) returns true.
Example:
#!/usr/bin/python # -*- coding: UTF-8 -*- a = 21 b = 10 c = 0 if a != b : print "a 不等于 b" else: print "a 等于 b"
Output:
a 不等于 b
Recommended related articles:
1.Seven basic Python operators
2.python operator - the most commonly used comparison operator in programming (example analysis)
Related video recommendations:
1.Zero Basic Introduction to Little Turtle Learning Python video tutorial
Related recommendations: "Python Tutorial"
The above is the detailed content of How to express "not equal" in python. For more information, please follow other related articles on the PHP Chinese website!