About 65,100 results
Open links in new tab
  1. python - How do I write a loop to repeat the code? - Stack Overflow

    Feb 5, 2021 · A loop is the best way to achieve this. For example check out this pseudo code: While person is hungry Eat food a bite of food Increase amount of food in stomach If amount …

  2. python - How to repeat a for loop - Stack Overflow

    Sep 13, 2015 · I have got one problem with Python. I'm trying to repeat a for loop more than once. I have a condition inside the loop, and if the condition is true, the loop should start again. I …

  3. Repeat-until or equivalent loop in Python - Stack Overflow

    Dec 15, 2017 · A while loop continues as long as its condition is True, a repeat loop continues until its condition is True. @snr is wrong, but it's a common mistake. Compare: while …

  4. python - How to repeatedly execute a function every x seconds?

    This code will run as a daemon and is effectively like calling the python script every minute using a cron, but without requiring that to be set up by the user. In this question about a cron …

  5. python - for or while loop to do something n times - Stack Overflow

    Jul 15, 2013 · continue - moves on to the next time around the loop without executing following code this time around; else - is executed if the loop completed without any break statements …

  6. if statement - python repeat program while true - Stack Overflow

    Sep 24, 2012 · When you're writing a standalone Python program, it’s a good practice to use a main function. it allows you to easily add some unit tests, use your functions or classes from …

  7. python - How to repeat try-except block - Stack Overflow

    Mar 5, 2013 · EDIT: user2678074 makes the valid point that this could make debugging difficult as it could get stuck in an infinite loop. I would make two suggestions to resolve this - firstly use a …

  8. python - Repeating while loop, until cancel - Stack Overflow

    Jan 31, 2012 · Use break to break out of the while loop: There is no need to test if answer is in ('yes',), since the while True loop will continue looping by default: answer in ('no') is the same …

  9. loops - Looping a python "if" statement - Stack Overflow

    May 28, 2012 · I'm building a kind of question sequence as part of a program in Python 3.2. Basically, I ask a question and await an answer between two possibilities. If the given answer …

  10. Python: How to keep repeating a program until a specific input is ...

    Every time I write a while loop where the variable that the condition checks is set inside the loop (so that you have to initialize that variable before the loop, like in your second example), it …

Refresh