Skip to content
murmot

Results for “python while loop string example code find site:wiki.python.org 2”

  • wiki.python.org

    For Loop - Python Wiki

    The Python for statement iterates over the members of a sequence in order, executing the block each time. Contrast the for statement with the ‘’while’’ loop, used when a condition needs to be checked each iteration or to repeat a block of code forever. For example: For loop from 0 to 2, therefore running 3 times.

  • wiki.python.org

    Simple Programs - Python Wiki

    For current documentation, see python.org. The examples below will increase in number of lines of code and difficulty: ... ') 11 lines: Triple-quoted strings, ...

  • wiki.python.org

    While loops - Python Software Foundation Wiki Server

    While loops Usage in Python When do I use them? While loops, like the ForLoop, are used for repeating sections of code - but unlike a for loop, the while loop will not run n times, but until a defined condition is no longer met. If the condition is initially false, the loop body will not be executed at all.

  • wiki.python.org

    For Loop - Python Wiki

    There are two ways to create loops in Python: with the for-loop and the while-loop. When do I use for loops¶. for loops are used when you have a block of code ...

  • wiki.python.org

    ForLoop

    Python for loop and while loop tutorial with interactive code examples.

  • wiki.python.org

    Python Speed / Performance Tips

    (Python automatically shares one- and two-character strings.) In the minus ... You may be stuck with the for loop. The for loop example has another inefficiency.

  • wiki.python.org

    Range Generator - Python Wiki

    The alternate implementation is fine, though I'd prefer to see a “takewhile” rather than a while loop in the spirit of functional programming - but thats minor.

  • wiki.python.org

    Handling Exceptions - Python Wiki

    String exceptions are one example of an exception that doesn’t inherit from Exception. – MikeRovner I believe that as of 2.7, exceptions still don’t have to be inherited from Exception or even BaseException. However, as of Python 3, exceptions must subclass BaseException. – ElephantJim Getting Useful Information from an Exception ¶

  • wiki.python.org

    Powerful Python One-Liners - Python Wiki

    The source code is contributed from different Python coders — Thanks to all of them! ... python string and list methods. Here is an example from the homepage:.

  • wiki.python.org

    Getting Started - Python Wiki

    Simple Programs (Chinese) – the same graduated examples, translated into Chinese Learn Python – learning Python through XML, XSLT, and other practical code samples While Loop – a focused explanation of while loops with usage patterns Practice and Project Ideas ¶

  • wiki.python.org

    Bit Manipulation - Python Wiki

    "decafbad" : int(str, 16) (known to work in Python 2.4). Integers to Strings: "1011101101" : built-in to Python 3 (see below).