Home > Backend Development > Python Tutorial > What does == mean in python

What does == mean in python

藏色散人
Release: 2021-01-26 17:48:46
Original
79029 people have browsed it

== in python means equal, and is a comparison operator in python. The function of this operator is to compare whether two values ​​are equal. Its comparison syntax is "x==y". If compared If the two values ​​​​are not equal, False will be returned, and if they are equal, true will be returned.

The operating environment of this tutorial: Acer S40-51 computer, Windows10 Home Chinese version system, python3.8.6 version

Recommended: "pythonvideotutorial

What does == mean in python?

== in python is a comparison operator, that is, the equal operator, which is used to compare whether two values ​​are equal. If they are not equal, it returns False, and if they are equal, it returns true.

How to use the equal operator in python:

First create a py file and name it python_compare;

Then define two variables x and y;

Then enter "print(x == y)" to print out the comparison result;

The complete code content is as follows:

x = 5
y = 3

print(x == y)

# python中==是比较运算符,是用于比较两个值是否相等的,若不相等则返回False,若相等则返回true。
Copy after login

Then open the cmd window and enter the command "python python_compare.py"

What does == mean in python

Finally press Enter to view the comparison results.

The above is the detailed content of What does == mean 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