== 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。
Then open the cmd window and enter the command "python python_compare.py"
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!