Related computing operation description x + y addition x ** y multiplication side x-y subtraction x % y modulo (xmody) x * y multiplication + x mona1 addition xy division (2.6 removes decimals)-y unary subtraction xy truncation division xifyelsez ternary expression comparison operation... related computing
| Operation |
Description |
Operation |
Description |
| X + y |
Addition |
X ** y |
Multiplication party |
| X-y |
Subtraction |
X % y |
Modulo (x mod y) |
| X * y |
Multiplication |
+ X |
Mona1 addition |
| X/y |
Division (2.6 saving the fractional part) |
-Y |
Unary subtraction |
| X // y |
Truncation |
X if y else z |
Ternary expression |
Comparison
| Operation |
Description |
Operation |
Description |
|
| X <y |
X shifts y places to the left. |
X \ |
Y |
By bit or |
| X> y |
X shifts right to y places |
X ^ y |
Bitwise OR |
|
| X & y |
Bitwise AND |
~ X |
Reverse search by bit |
|
Description of numbers
Is_integer
Test whether the floating point number is an integer.
Numeric-related modulesmath,random
Int () and math. trunc () will omit the decimal part. the round () function can be rounding, math. the floor will retain the decimal place as 0 in 2.7, and the effect is the same as that in int in 3.0.
Python3.0 does not support Dictionary comparison and can be replaced by sorted (dict. items ().
Set
Add () insert
Update () returns the Union by position
Remove () deletes a project by value
Why use a set?
Filter out repeated items
Record the Accessed locations
The above is the details of the python core data type Numeric type and set. For more information, see other related articles in the first PHP community!