int, float type
Python's int, float type has no explicit scope restrictions relative to other languages, Python
The value of the int, float type can be stored is determined by the hardware
Decimal can be directly written, octal is 0o beginning, hex 0x starts, binary 0b starts
Mathematical operators
+ Plus
-Minus
* Multiply if the string is multiplied by a number to indicate that the string repeats several times
* * Calculation of the sub-party
/except
Divisible
% take-up
Built-in functions and tool modules for numeric values
Built-in functions
Int () converts to int (value, binary) example: Int ("1101", 2) Int ("177", 8) int ("9ff", 16)
Float () converted to float type value
Round () rounding
Bin (number) is converted to binary
Oct (number) converted to octal
Hex (number) converted to hex
Tool module math, importing modules
functions under the Math module
Floor () to go down to the whole, in a small direction to take "3..14 obtained is 3, -3..14 obtained is-4"
Trunc () to 0 in the direction of the value "3.14 obtained is 3, 3.14 obtained is-3"
Ceil () rounded up, toward the large direction "3.14 obtained is 4, 3.14 obtained is 3"
Math.PI can get pi value
Pow (2,4) 2 of the four-time square
SQRT (81) Open Square
Precision processing of floating-point type
Under normal circumstances, you should get 0, but you get a different value. This is the problem of precision.
The decimal module solves this problem of precision, which provides a decimal class, which takes into the form of a string when passing a value
Another way to import
The nature of Bool
BOOL only true vs. false corresponds to 1 and 0
Built-in function bool () converts a value to a bool value
0, 0.0, [], {}, ', None will be converted to false
Basic introduction to Python 0 (6)-------numeric type