Related numbers related to underlying data types
- Data type conversions
- bool ()
To Boolean type
1 print ( BOOL ([])) # False 2 print (bool ( ")) # False 3 print (bool (0)) # 4 print (bool ({})) # False 5 print (bool (())) #
view code
- Int ()
Turn shaping
1 Print (Int ('3')) # 3
View Code
- Float ()
Turn floating point type
1 Print (Float ('3')) # 3.0
View Code
- Complex ()
to complex type
1 print (Complex ( " 3 )) # (3+0j)
view code
- Binary conversion
- Bin ()
Turn binary
1 Print (Bin (2)) # 0B10
View Code
- Oct ()
Turn octal
1 Print (Oct (2)) # 0o2
View Code
- Hex ()
Turn hex
1 Print (Hex (2)) # 0x2
View Code
- Mathematical operations
- ABS ()
Absolute
1 Print (ABS ( -3)) # 3
View Code
- Divmod ()
In addition to the remainder
1 Print (Divmod (9, 4)) # (2, 1) quotient 2 + 1
View Code
- Round ()
Precise decimal digits
1 Print (Round (3.5687789,3)) # 3.569
View Code
- POW ()
Power operation
1 Print (Pow (2,3)) # 8
View Code
- SUM ()
Sum
1 Print (SUM ([2,3])) # 5
View Code
- Max ()
Maximum Value
1 Print (Max ([2,3])) # 3
View Code
- Min ()
Minimum value
1 Print (min ([2,3])) # 2
View Code
Python Foundation 10th day-built-in functions