Digital processing, math module

import math

math.floor (2.5): rounded down

math.ceil (2.5): rounding up

x // y: the result is rounded down

round (x): rounded banker decoupling

  x> 0.5: enter into a

  x <0.5: removing the decimal

  x = 0.5: take the nearest even

min () for the minimum

max () selecting the maximum value

math.sqrt () Roots

bin () Binary: Returns a string

oct () octal: Returns a string

hex () hex: Returns a string

 

math.pi represent pi 3.1415926 ....

math.e represents a natural constant

the isinstance (object type) returns a Boolean value

Examples: isinstance (16, (int, str, bool)) returns True

Guess you like

Origin www.cnblogs.com/lovesix/p/11986585.html