About 316,000 results
Open links in new tab
  1. Python loop to run for certain amount of seconds

    I have a while loop, and I want it to keep running through for 15 minutes. it is currently: while True: #blah blah blah (this runs through, and then restarts. I need it to continue doing this ...

  2. python - How to make program go back to the top of the code …

    Python has control flow statements instead of goto statements. One implementation of control flow is Python's while loop. You can give it a boolean condition (boolean values are either True …

  3. python - How to repeat a while loop a certain number of times

    Jan 13, 2018 · Use while. i = 0 while i < n: # do something here i += 1 If the loop variable i is irrelevant, you may use _ instead. for _ in range(n): # do something here _ = 0 while _ < n # do …

  4. python: restarting a loop - Stack Overflow

    Jan 29, 2009 · Changing the index variable i from within the loop is unlikely to do what you expect. You may need to use a while loop instead, and control the incrementing of the loop variable …

  5. How can I make my program return to the beginning in Python?

    This means the loop will be executed as long as the value of the variable 'loop' remains 4. But since you assign 2 to loop, the condition is not satisfied, and control goes out of the loop. One …

  6. python - How to do while loops with multiple conditions - Stack …

    condition1 = False condition2 = False val = -1 #here is the function getstuff is not defined, i hope you define it before #calling it into while loop code while condition1 and condition2 is False and …

  7. python - How to run a script forever? - Stack Overflow

    Yes, you can use a while True: loop that never breaks to run Python code continually. However, you will need to put the code you want to run continually inside the loop: #!/usr/bin/python …

  8. Is there a faster way to do a while loop in python?

    Apr 5, 2014 · In fact, the overhead of a while loop is virtually imperceptible. Your measurements must be off if you think the statements run fast outside of the loop. Reading data from a file or …

  9. 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 …

  10. Calculator Loop in Python - Stack Overflow

    Apr 20, 2016 · Need to add a loop to my calculator by giving the user an option to restart the calculator by putting the code in a while loop with the condition that the input from user should …