0

I want to call a Python function of no arguments, repeatedly for n times. And return a list.

Is there a more pythonic way than the following?

   def repeat(func, n):
      return [func() for i in range(n)]
user3240688
  • 1,088
  • 2
  • 12
  • 26

0 Answers0