# no of steps taken to reduce n to 0 by applying division if even or subtraction if odd
def nos(n):
def helper(n,c):
if n==0:
print(c)
return c
if n % 2 == 0:
c += 1
helper(n / 2,c)
else:
c += 1
helper(n - 1,c)
return helper(n, 0)
x=nos(8)
print(x)
The output is giving 4 which comes from print(c), and None which is from print(x), Can someone pls explain why output is not coming 4 as i am returning c which is 4.