This article brings you a brief introduction to operators in python3. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
Expression
Operator
Operator classification:
Arithmetic operators
Relational operators
Assignment operators
Logical operators
Bit operations
Member operations
Identity operators
Arithmetic operators
Comparison operator
- Compares two variables or values
- The result of the operation is a Boolean value , that is, false/true
- == equal sign != not equal to > greater than f577d3741698878403a72fd1b37c4573= greater than or equal to <= less than or equal to
Assignment operator
- =, assignment
- =, is an abbreviation (a =b is equivalent to a=a b), the same principle Also: -=
= /= //= %= *=
##Logical operator
for Boolean Values are operated on and logical AND or logical OR not logical NOT Operation rules:
and is regarded as multiplication, or is regarded as addition True is regarded as 1, False is regarded as 0 The logical operation can be converted into integer mathematical operation The final result is 0, otherwise it is False For True
Short-circuit problem of logical operations
Logical operation expressions are calculated according to the order of operations. Once If the future value of the entire formula can be determined, the calculation will no longer be performed and the
#member operator
in is used. Test whether a variable is a member of another variable not in identity operator
is is used to detect whether two variables are the same variable not is Operator priority issue
Basic introduction to operators in php
python operator-identity operator for objects (example analysis)
The above is the detailed content of A brief introduction to operators in python3. 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