<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # Python 數學函數 > 原文: [https://thepythonguru.com/python-mathematical-function/](https://thepythonguru.com/python-mathematical-function/) * * * 于 2020 年 1 月 7 日更新 * * * Python 具有許多內置函數。 | 方法 | 描述 | | --- | --- | | `round(number[, ndigits])` | 四舍五入數字,也可以在第二個參數中指定精度 | | `pow(a, b)` | 將`a`提升到`b`的冪 | | `abs(x)` | 返回`x`的絕對值 | | `max(x1, x2, ..., xn)` | 返回提供的參數中的最大值 | | `min(x1, x2, ..., xn)` | 返回提供的參數中的最小值 | 下面提到的函數位于`math`模塊中,因此您需要使用以下行首先導入`math`模塊。 ```py import math ``` | 方法 | 描述 | | --- | --- | | `ceil(x)` | 此函數將數字四舍五入并返回其最接近的整數 | | `floor(x)` | 此函數將向下取整并返回其最接近的整數 | | `sqrt(x)` | 返回數字的平方根 | | `sin(x)` | 返回`x`的正弦,其中`x`以弧度表示 | | `cos(x)` | 返回`x`的余弦值,其中`x`為弧度 | | `tan(x)` | 返回`x`的切線,其中`x`為弧度 | 讓我們舉一些例子來更好地理解 ```py >>> abs(-22) # Returns the absolute value 22 >>> >>> max(9, 3, 12, 81) # Returns the maximum number 81 >>> >>> min(78, 99, 12, 32) # Returns the minimum number 12 >>> >>> pow(8, 2) # can also be written as 8 ** 2 64 >>> >>> pow(4.1, 3.2) # can also be written as 4.1 ** 3.2 91.39203368671122 >>> >>> round(5.32) # Rounds to its nearest integer 5 >>> >>> round(3.1456875712, 3) # Return number with 3 digits after decimal point 3.146 ``` ```py >>> import math >>> math.ceil(3.4123) 4 >>> math.floor(24.99231) 24 ``` 在下一篇文章中,我們將學習[如何在 python](/python-generating-random-numbers/) 中生成隨機數。 * * * * * *
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看