def even_divide_count(num1, num2):
y = 0
number = num1 // num2
if number % 2 == 1 or number == 0:
return 0
else:
even_divide_count(number, num2)
y += 1
return y
I apologize because this is the first question I'm asking on stack overflow so apologizes for the formatting. I'm attempting to maintain the value for the variable y through recursion however the maximum value I get when y is returned is 1 as it doesn't end up adding all the y values through levels of incursion. Any help is greatly appreciated!
*updated because I forgot a line
def even_divide_count(num1, num2):
y = 0
number = num1 // num2
if number % 2 == 1 or number == 0:
return 0
else:
1 + even_divide_count(number, num2)
y += 1
return y
*found my answer, it's posted above