How to count function calls? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to count function calls?

I want to count the function calls of the Ackermann function: def A (m,n,s="%s): print (s% ("A (%d,%d)" % (m,n))) if m==0: return n+1 if n==0: return A (m-1, 1, s) n2= A (m,n-1,s% ("A (%d,%%s)" % (m-1))) return A (m-1,n2,s) print (A (2,2))

13th Jun 2017, 8:03 AM
lars
1 Answer
+ 1
The function looks incorrect when I paste into the editor. Please refer to StackOverflow at https://stackoverflow.com/questions/23047680/find-number-of-times-ackerman-function-is-called-in-JUMP_LINK__&&__python__&&__JUMP_LINK
13th Jun 2017, 10:17 AM
Venkatesh Pitta
Venkatesh Pitta - avatar