Python数学常量


Python数学常量:

  math.pi:π

  math.e:自然常数 e

程序:

import math # 查看 pi 和 e 的值 print(math.pi) # 3.141592653589793 print(math.e) # 2.718281828459045 # 计算圆的面积 r = 2 print(math.pi * r ** 2) # 12.566370614359172 # lg 函数中求值  a = math.e b = math.e ** 5 print("ln(a)的值为:",math.log(a)) # ln(a)的值为: 1.0 print("ln(b)的值为:",math.log(b)) # ln(b)的值为: 5.0

2020-02-06


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM