Home > front end >  Can I make a Nested Recursion in python?
Can I make a Nested Recursion in python?

Time:12-07

Current Code:

def recur(n):
    
    if n>12:
        return
    
    #actions
    Dev.step(n)
    Dev.turnRight()
    
    
    #recursion
    recur(n 2)
    
recur(2)

I'm new to python. Is there any possibilites to make a nested recursion. I want to make like nested for loop but, I use recursion function.

CodePudding user response:

n=10 def test(n): if n<=0: return 1 else: return test(test(n-1) 1) print test(n

CodePudding user response:

Certainly your question is not clear to anyone. Also from your code i am not able understand what is Dev.step(n) & Dev.turnRight() is it a method or class function you are calling. please give that code as well in the description.

  • Related