python中math.pi()是什么意思

如题所述

因为pi是python,math函数库中的一个内建函数。

import math

print "math.modf(100.12) : ", math.modf(100.12)

print "math.modf(100.72) : ", math.modf(100.72)

print "math.modf(119L) : ", math.modf(119L)

print "math.modf(math.pi) : ", math.modf(math.pi)

扩展资料:

cmath是python中的标准库函数,用于做复杂的复数运算,

Python cmath 模块包含了一些用于复数运算的函数。

cmath 模块的函数跟 math 模块函数基本一致,区别是 cmath 模块运算的是复数,math模块运算的是数学运算。

polar 函数对一个输入的笛卡尔形势的复数进行计算,输出为一个二元组,第一个值为Z的模值, 第二个为幅度值。 rect() 函数对输入的模和幅度值进行计算输出笛卡尔表示。如果需要单独对一个复数进行幅度值的求解,可以调用 cmath.phrase(x) 函数,返回幅度值。

参考资料来源:百度百科-pyhton cmath

温馨提示:内容为网友见解,仅供参考
第1个回答  推荐于2018-02-26
就是圆周率数值
用于数学计算
死记硬背个圆周率 不是程序员的作风~
以下是用法
>>> import math
>>> math.pi
3.141592653589793
>>>本回答被网友采纳
第2个回答  2019-12-23
Math点pi这是一个函数主要就是表示圆周率3.14在这个程序当中你输入这个函数过后他就返回给你一个圆周率
第3个回答  2012-05-06
模块变量,圆周率,请不要 当成函数调用。
第4个回答  2012-05-04
Python 2.7.2+ (default, Oct 4 2011, 20:03:08)
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> math.pi()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'float' object is not callable
>>> math.pi
3.141592653589793
>>>
相似回答