学习笔记(4):零基础掌握 Python 入门到实战-一个圆点的何去何从(三)

    科技2025-09-07  64

    立即学习:https://edu.csdn.net/course/play/26676/338773?utm_source=blogtoedu

    >>> import math >>> dir(math) ['__doc__', '__loader__', '__name__', '__package__', '__spec__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'comb', 'copysign', 'cos', 'cosh', 'degrees', 'dist', 'e', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'gcd', 'hypot', 'inf', 'isclose', 'isfinite', 'isinf', 'isnan', 'isqrt', 'ldexp', 'lgamma', 'log', 'log10', 'log1p', 'log2', 'modf', 'nan', 'perm', 'pi', 'pow', 'prod', 'radians', 'remainder', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'tau', 'trunc'] >>> math.pi 3.141592653589793 >>> math.pow(2,3) 8.0 >>> 2**3 8 >>> 2*3 6 >>> 0.1+0.2 0.30000000000000004 >>> import decimal >>> a = decimal.Decimal('0.1') >>> b = decimal.Decimal('0.2') >>> a Decimal('0.1') >>> b Decimal('0.2') >>> a+b Decimal('0.3')

    >>> 2**1000 10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376 >>> 2**1000*.1 1.0715086071862674e+300 >>> 2**10000*.1 Traceback (most recent call last):   File "<stdin>", line 1, in <module> OverflowError: int too large to convert to float

    相关资源:四史答题软件安装包exe
    Processed: 0.011, SQL: 9