Light Mode
Dark Mode
what is wrong in my solution?

I tried the code in other IDE (without function), the body seems to work properly. What causes an error here? I am using for loop to cut the last digit each time it's looping through, and outputting the number of loops (counter) it went through.

def number_length(a: int) -> int:

counter = 0
for i in range(a):
    a // 10
    counter += 1

return counter
Created: Oct. 15, 2021, 10:01 a.m.
Updated: Oct. 18, 2021, 9:59 a.m.
0
3
User avatar
Alexandra_Berger