i = 1
input_number = int(input("Input a digit you wish to count: "))
def count(n):
    global i
    n = int(n/10)
    if n > 0:
        i = i+1
        count(n)
    else:
        j = i
        print(f"j={j}")
        return j
j = count(input_number)
print(f"i={i}")
print(j)
I'm trying to use a recursive way to print the digits of a number. I used a global counter to count, and can print the global counter as result. However, my question is - why can't I make the function to return the counter and print the function result directly? It returns None somehow.
 
     
    