About 19,800 results
Open links in new tab
  1. python - How to do while loops with multiple conditions - Stack Overflow

    use an infinity loop like what you have originally done. Its cleanest and you can incorporate many conditions as you wish. if condition1 and condition2: break. ... if condition3: break. ...

  2. Writing a Python While Loop with Multiple Conditions

    Mar 11, 2021 · In this article, you learned how to write a Python while loop with multiple conditions. You reviewed indefinite iteration and how while statements evaluate conditional …

  3. multiple conditions with while loop in python - Stack Overflow

    Oct 26, 2014 · You need to use and; you want the loop to continue if all conditions are met, not just one: while (name != ".") and (name != "!") and (name != "?"): You don't need the …

  4. Python While Multiple Conditions

    May 7, 2024 · In this Python tutorial, you learned how Python while multiple conditions works. We used two different logical operators, the “or” and “and” operators in Python, and gave practical …

  5. Python While Loop with Multiple Conditions - datagy

    Sep 25, 2021 · In this tutorial, you’ll learn how to write a Python while loop with multiple conditions, including and and or conditions. You’ll also learn how to use the NOT operator as …

  6. while loop multiple conditions Python - Stack Overflow

    Aug 24, 2011 · Hello, I have the following function: def width(input,output,attr): import re input = input.strip() if re.search(attr, input): k = input.find(attr) for i in input: if i == attr[0]: j = k + …

  7. Python while loop with multiple conditions [SOLVED]

    Nov 16, 2022 · To specify multiple conditions in a while loop, we use logical operators like AND, OR, and NOT to give multiple conditions to a while loop. We will see each logical operator with …

  8. Python While Loops - W3Schools

    Python has two primitive loop commands: 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 …

  9. Python While Loop with Multiple Conditions - Tutorial Kart

    To write Python While Loop with multiple conditions, use logical operators like Python AND, Python OR to join single conditions and create a boolean expression with multiple conditions.

  10. Python while Loops: Repeating Tasks Conditionally

    In this tutorial, you'll learn about indefinite iteration using the Python while loop. You'll be able to construct basic and complex while loops, interrupt loop execution with break and continue, use …

  11. Some results have been removed
Refresh