How to express 'not equal' in python

藏色散人
Release: 2019-11-23 15:00:40
Original
26694 people have browsed it

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"
Copy after login

Output:

a 不等于 b
Copy after login
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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!