my recursive function is in RecursionError when being called by my tempsExecution2 function in the times i use more than 2 ceros for the quantity. I dont know why this happends nor how to fix it and i would like to test big numbers of operations.
# 1 -RECURSIVE FUNCTION
def sommeRec(n):
if n == 0: #cas de base #ERROR line
return 0
else:
if n > 0:
return sommeRec(n-1) + n #appel recursive
print(sommeRec(3))
def tempsExecution2(n,f):
start=time()
f(n)
end=time()
return end-start
print("le temps d'exe de sommeRec est: ")
print(tempsExecution2(2000,sommeRec))
def tempsExecution2(n,f):
start=time()
f(n)
end=time()
return end-start
print("le temps d'exe de sommeRec est: ")
print(tempsExecution2(200,sommeRec)) #why cant i use bigger numbers?