Skip to content
murmot

Results for “python while loop string example program script find site:wiki.python.org”

  • 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 ... ') 11 lines: Triple-quoted strings, while loop. REFRAIN = ''' {} bottles of ...

  • 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. As the for loop in Python is so powerful, while is rarely used, except in cases where a ...

  • wiki.python.org

    For Loop - Python Wiki

    When running the above example, you can stop the program by pressing ctrl+c at the same time. As you can see, these loop constructs serve different purposes.

  • wiki.python.org

    Programmatic - Python Wiki

    For current documentation, see python.org. Programmatic presentation systems (see DataRepresentation) use Python program units to produce output for Web ...

  • wiki.python.org

    ForLoop

    When running the above example, you can stop the program by pressing ctrl+c at the same time. As you can see, these loop constructs serve different purposes. The for loop runs for a fixed amount of times, while the while loop runs until the loop condition changes.

  • wiki.python.org

    Getting Started - Python Wiki

    Getting Started ¶ New to Python, or new to programming entirely? This section collects beginner-friendly guides, example programs, and practice exercises. Most of this content was written by community members over the years and reflects a range of teaching styles.

  • wiki.python.org

    Regular Expression - Python Wiki

    (All images PD, released by author, LionKimbro.) Searching & Matching¶. You can search or match. search – find something anywhere in the string, and return it.

  • wiki.python.org

    Python Speed / Performance Tips - Python Wiki

    Repeat from 2. Certain optimizations amount to good programming style and so should be learned as you learn the language. An example would be moving the calculation of values that don’t change within a loop, outside of the loop. Choose the Right Data Structure ¶ TBD. Sorting ¶ Sorting lists of basic Python objects is generally pretty efficient.

  • wiki.python.org

    Debugging with Gdb - Python Wiki

    So you may need to tweak the while-loops depending on the program you're intending to debug. See, for example, this StackOverflow post for another (putative) ...