About 27,100 results
Open links in new tab
  1. Python while loop with string - Stack Overflow

    Jan 27, 2015 · Your while loop compares each character with the last, a, stopping when it finds a character that isn't equal or higher than a. Your code stops at the space because the latter's position …

  2. Python while Loops: Repeating Tasks Conditionally

    Mar 3, 2025 · In the following sections, you’ll learn how to use while loops effectively, avoid infinite loops, implement control statements like break and continue, and leverage the else clause for …

  3. Python While Loops - W3Schools

    With the while loop we can execute a set of statements as long as a condition is true. Note: remember to increment i, or else the loop will continue forever. The while loop requires relevant variables to be …

  4. How to Loop Over a String in Python - Delft Stack

    Mar 11, 2025 · This tutorial demonstrates how to iterate over a string in Python. Learn various methods including for loops, while loops, list comprehension, and the enumerate function.

  5. Loop Through String Characters in Python: A Guide - PyTutorial

    4 days ago · Learn how to loop through characters in a string in Python using for loops, while loops, enumerate, and list comprehension with clear examples and code.

  6. 8 Python while Loop Examples for Beginners - LearnPython.com

    Feb 5, 2024 · Looking for a Python while loop example? Discover what a Python while loop is and how to use it efficiently.

  7. While Loop - Computer Science

    The while-loop has more flexibility, looping until a boolean test is False. The earlier for-loop is very handy to loop over a collection, but that collection needs to be known ahead of time.

  8. Loops in Python - GeeksforGeeks

    Feb 14, 2026 · In Python, a while loop is used to execute a block of statements repeatedly until a given condition is satisfied. When the condition becomes false, the line immediately after the loop in the …

  9. 7.3. Traversal through a string with a loopPython for Everybody ...

    Write a while loop that starts at the last character in the string and works its way backwards to the first character in the string, printing each letter on a separate line.

  10. Python while Loop (With Examples) - Programiz

    In Python, we use the while loop to repeat a block of code until a certain condition is met.