先貼出參考資料地址:http://www.runoob.com/python3/python3-number.html
Python math 模塊、cmath 模塊
Python 中數學運算常用的函數基本都在 math 模塊、cmath 模塊中。
Python math 模塊提供了許多對浮點數的數學運算函數。
Python cmath 模塊包含了一些用於複數運算的函數。
cmath 模塊的函數跟 math 模塊函數基本一致,區別是 cmath 模塊運算的是複數,math 模塊運算的是數學運算。
要使用 math 或 cmath 函數必須先導入: