About 102,000 results
Open links in new tab
  1. python - How do I call a function twice or more times …

    Here is an approach that doesn't require the use of a for loop or defining an intermediate function or lambda function (and is also a one-liner). The method combines the following two ideas: …

  2. Repeating a function in Python - Stack Overflow

    Feb 6, 2014 · How do I repeat a function in python. Such as Repeat... Unil in other languages. Thanks, this is the code ...

  3. python - How to repeat a function n times - Stack Overflow

    Sep 9, 2011 · I'm trying to write a function in python that is like: def repeated(f, n): ... where f is a function that takes one argument and n is a positive integer. For example if I defined square …

  4. python - How do I write a loop to repeat the code? - Stack Overflow

    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 of food ate fills …

  5. Repeat function python - Stack Overflow

    Jun 17, 2014 · I'm stuck at higher-order functions in python. I need to write a repeat function repeat that applies the function f n times on a given argument x. For example, repeat(f, 3, x) is …

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

    I want to repeatedly execute a function in Python every 60 seconds forever (just like an NSTimer in Objective C or setTimeout in JS). This code will run as a daemon and is effectively like …

  7. python - Repeating elements of a list n times - Stack Overflow

    Jun 15, 2014 · For base Python 2.7: from itertools import repeat def expandGrid(**kwargs): # Input is a series of lists as named arguments # output is a dictionary defining each …

  8. loops - Is there a "do ... until" in Python? - Stack Overflow

    Jun 21, 2015 · Python 2.7.3 $ python -mtimeit 'while 0:pass' 100000000 loops, best of 3: 0.0132 usec per loop $ python -mtimeit 'while False:pass' 10000000 loops, best of 3: 0.0538 usec per …

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

    Sep 24, 2012 · Usually you use the file to define different function, including the main() function for the files you are going to execute directly. So you use the main() function for everything …

  10. How to repeat a function multiple times in python [duplicate]

    Use a loop: def f(x): return x+2 x = 1 for _ in range(20): x = f(x) print(x) Return the value from the function and call the function with the new value.