python - Counting the number of recursion of a function within the function -


I am working on this function and within the function I want to calculate the number of revision / revision of the function. Any and all help will be helpful! Def Run Generation (L): "" "Regeneration is evolving ..." "Calculation = 0 Show (L) Print (L) Time. Sleep (0.05) If AllOnes (L) == True: Return L Other: NewL = evolve (L) Return run generation (NL) + 1

  DIF Run Generation (L, Count = 1): Show (L) = "text"> 

You can pass the count argument from your recursive series: print (L) if all the on (L) : Print ("Result {} has been found after the efforts". Format (count)) LLL = V Returns to Grace (NL, Count + 1) + 1 / Pre>

This program does not really need to be recursive, though it will be an incomplete solution: < Pre = def runGenerations_iterative (L): count = 1 Show (L) Print (L) while allOnes (L) No: L = Grow (L) count + = 1 (L, Count)) L + Calculation - 1 Return to ) (L) Print (L) Print ("Result {} found after the efforts"

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -