First let me double check if I understood what you need: you have to place numTries
sequential calls to tryConfiguration(floorplan,numLights)
, and each call is the same as the others.
If it is so, and if tryConfiguration
is synchronous, you can just use a for loop:
for _ in xrange(numTries):
tryConfiguration(floorplan,numLights)
Please let me know if I'm missing something: there could be other solutions, like leveraging closures and/or recursion, if your requirements are different.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…