Home  >  Article  >  Backend Development  >  How to express "not equal" in python

How to express "not equal" in python

藏色散人
藏色散人Original
2019-07-01 11:35:5026689browse

How to express

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn