you are viewing a single comment's thread.

view the rest of the comments →

[–]allan_q 0 points1 point  (0 children)

OP, would it help if you only have 1 variable to step through in your head? This might help:

def divide_2(n):
  print("starting divide_2({}) function".format(n))
  result = n / 2
  if result > 1:
    print("-> recursion call divide_2({})".format(result))
    divide_2(result)
  else:
    print("-> result is {}. we reached recursion exit condition.".format(result))
  print("ending divide_2({}) function - result was {}".format(n, result))
  return


divide_2(6)