you are on the right track, so when its less than 10 you know that its a single digit so you can return 1, otherwise its greater than 10 so return 1 + the result of the function passing in x // 10
def count(x):
if abs(x) > 10:
return 1 + count(x // 10)
return 1
for i in (1, 23, 345, 454564, 34, -345, -98):
print(f'There are {count(i)} digits in the number {i}')
OUTPUT
There are 1 digits in the number 1
There are 2 digits in the number 23
There are 3 digits in the number 345
There are 6 digits in the number 454564
There are 2 digits in the number 34
There are 3 digits in the number -345
There are 2 digits in the number -98
len(x)