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