Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 22 Online
OpenStudy (anonymous):

IS THERE A WAY TO COUNT THE NUMBER OF RECURSIVE STEPS IN A RECURSION PROGRAM

OpenStudy (anonymous):

You can add a global variable, like count = 0, then incrementing it by 1 every time you call the function (like at the beginning of the function). Or, somewhat better, passing some counting variable, like count, as another argument, and set the default to 0. See this: http://codepad.org/WRPMlGvq

OpenStudy (anonymous):

Try to input the function into a other function. and you have def a(): counter+=1 def b(): actual function or make a class. and for each call of the instance the counter get +1. i hope it answered you question.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!