current position:Home>Recursive program running error, is there a maximum limit for recursion?

Recursive program running error, is there a maximum limit for recursion?

2022-02-02 20:32:51 CSDN Q & A

img

img




Refer to the answer 1:

View the maximum depth of recursion :

import sysl = sys.getrecursionlimit()print(l)# If you want to continue using recursion , It can be changed temporarily sys.setrecursionlimit(10000)def HEJI(n):    if n == 1 :        return n    else:        return n + HEJI(n - 1)    s = HEJI(999)print(s)



Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202022032502854.html

Random recommended