About 2,720,000 results
Open links in new tab
  1. Python While Loops - W3Schools.com

    The while Loop With the while loop we can execute a set of statements as long as a condition is true.

  2. Python While Loop - GeeksforGeeks

    Dec 23, 2025 · Python 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 …

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

  4. Loops in Python - GeeksforGeeks

    Mar 26, 2026 · Loops in Python are used to repeat actions efficiently. The main types are For loops (counting through items) and While loops (based on conditions). For Loop For loops is used to iterate …

  5. Iterating over lines in a file python - Stack Overflow

    Jul 28, 2015 · In the second one, file.read() returns the complete file data as a string. When you are iterating over it, you are actually iterating over the file's data character by character.

  6. How to Iterate Over a File Line by Line using a Loop in Python

    Iterate Over a File Line by Line Using a Loop in Python To read a file line by line in Python, you can use a loop with methods like readline(), readlines(), or iterate directly over the file object. This is useful …

  7. Files and While loops

    Files and While loops Introduction ¶ So far all the data in our programs has either been hardcoded into the program itself or else it came from the user who typed it in at the keyboard. This is pretty limiting …

  8. Python : How does `while` loop work in python when reading lines?

    Jun 16, 2016 · How does while loop work in python when reading lines? state=True #can be set to {anyInterger,True,False} while state: #do a task #if task done change state to exit loop so depending …

  9. 40 Python Loops Coding Exercises with Solutions – PYnative

    Mar 24, 2026 · Practice Python loops with 40 coding problems with solutions. Practice for, while, and nested loops. Perfect for beginners and intermediate programmers.

  10. Python read file in while loop - Stack Overflow

    Jan 17, 2014 · I am currently in some truble regarding python and reading files. I have to open a file in a while loop and do some stuff with the values of the file. The results are written into a new file. This ...