<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>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # break語句 `break`語句是用來 終止 循環語句的,即哪怕循環條件沒有稱為`False`或序列還沒有被完全遞歸,也停止執行循環語句。 一個重要的注釋是,如果你從`for`或`while`循環中 終止 ,任何對應的循環`else`塊將**不**執行。 ``` #!/usr/bin/python # Filename: break.py while True: ????s = raw_input('Enter something : ') ????if s == 'quit': ????????break ????print 'Length of the string is', len(s) print 'Done' ``` (源文件:[code/break.py](code/break.py)) ## 輸出 ``` $ python break.py Enter something : Programming is fun Length of the string is 18 Enter something : When the work is done Length of the string is 21 Enter something : if you wanna make your work also fun: Length of the string is 37 Enter something :???????use Python! Length of the string is 12 Enter something : quit Done ``` ## 它如何工作 在這個程序中,我們反復地取得用戶地輸入,然后打印每次輸入地長度。我們提供了一個特別的條件來停止程序,即檢驗用戶的輸入是否是`'quit'`。通過 終止 循環到達程序結尾來停止程序。 輸入字符串的長度通過內建的`len`函數取得。 記住,`break`語句也可以在`for`循環中使用。 ## G2的Python詩 我在這里輸入的是我所寫的一段小詩,稱為**G2的Python詩**: ``` Programming is fun When the work is done if you wanna make your work also fun: ??????use Python! ```
                  <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>

                              哎呀哎呀视频在线观看