开发者

Can I make a Nested Recursion in python?

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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜