What do you want to save?
Add Code snippet
New code examples
-
Other 2022-02-02 23:10:59
ex: for stopping the while loop after 5 minute in python
import time # timeout variable can be omitted, if you use specific value in the while condition timeout = 300 # [seconds] timeout_start = time.time() while time.time() < timeout_start + timeout: test = 0 if test == 5: break tes... Add solution -
Shell/Bash 2021-11-23 10:36:36
bash do while one line
while CONDITION_STATEMENT; do SOME_CODE; done Add solution -
Python 2021-10-25 04:12:16
What's the difference between a statement and an expression in Python?
#Here’s a general rule of thumb: If you can print it, or assign it to a #variable, it’s an expression. If you can’t, it’s a statement. #Here are some examples of expressions: 2 + 2 3 * 7 1 + 2 + 3 * (8 ** 9) - sqrt(4.0) min(2,... Add solution -
Python 2021-10-14 10:39:04
how to end an infinite loop in specific time python
import time # timeout variable can be omitted, if you use specific value in the while condition timeout = 300 # [seconds] timeout_start = time.time() while time.time() < timeout_start + timeout: test = 0 if test == 5: break tes... Add solution
Best helpers
Ranking is empty