Determine the total number of digits in the integer (`n>=0`) given as input to the function. For example, 9 is a single digit, 66 has 2 digits and 128685 has 6 digits. Be careful to avoid overflows/underflows.

All inputs will be valid.

Difficulty: introductory

Starter code:

def digits(n):
	

Solutions:
def digits(n):
    return len(str(n))

from math import log10,ceil

def digits(n):
    return ceil(log10(n+1))

from math import log10

def digits(n):
    return int(log10(n)+1)

def digits(n):
    return len('%s'%n)

from typing import Union
from re import findall

def digits(number: Union[int, str]) -> int:
    """ Get number of digits in given number. """
    return len(findall("\d", str(number)))

def digits(n):
   if n >= 0:
      dl = len(str(n))
   return dl


def digits(n):
    # your code here
    s = str(n)
    s_1 = list(s)
    s_1 = len(s_1)
    return s_1

def digits(i):
    return len(str(i))

def digits(n):
    s = str(n)
    return len(s)


def digits(n):
    c = 0
    while n != 0:
        c += 1
        n = n // 10
    return c

def digits(n):
    if(n == 0):
        return 1
    else:
        count = 0
        while(n):
            count += 1
            n //= 10
        return count

def digits(n):
    return sum([1 for i in str(n)])

def digits(n):
    count = 0
    while n != 0:
        count += 1
        n = n // 10
    return count

def digits(n):
    n = str(n)
    digits = 0
    for i, num in enumerate(n):
        digits += 1
    return digits

def digits(n):
    a=0
    for i in str(n):
        a+=1
    return a

import math
def digits(n):
    return math.log10(n)//1+1

def digits(n):
    # your code here
    count=len(str(n))
    return count

def digits(n):
    n = str(n)
    n = list(n)
    return len(n)

def digits(n):
    count = 0
    k = str(n)
    k = list(k)
    for num in k:
        count += 1
    return count 

def digits(n):
    j=list(str(n))
    return len(j)

def digits(n):
    answer = 0
    while n != 0:
        n = n // 10
        answer += 1
    return answer

def digits(n):
#     return len(str(n))
    cont = 0
    while n > 9:
        n //= 10
        cont+=1
    return cont+1

def digits(n):
    r=str(n)
    y = list(r)
    x=len(y)
    return(x)
    pass

def digits(n):
    sum = 0
    for num in str(n):
        sum += 1
    return sum

def digits(n):
    digits = 0
    for i in str(n):
        digits += 1
    return digits 

def digits(n):
    total = 1
    while n // 10 >= 1:
        n //= 10
        print(n)
        total += 1
    return total

def digits(n):
    y = str(n)
    return len(y)

def digits(n):
    count = 0
    while n != 0:
        n //= 10
        count += 1
    return count


from math import ceil, log

def digits(n):
    return ceil(log(n + 1, 10)) if 0 < n else 1


def digits(n):
    x=str(n)
    n=len(x)
    return int(n)

def digits(n):
    sn=str(n)
    cnt=0
    for i in sn:
        cnt+=1
    return cnt

from math import log10, floor


def digits(n: int) -> int:
    return floor(log10(n) + 1) if n else 0


def digits(n):
    tot = 0
    while n > 0:
        tot += 1
        n //= 10
    return tot

import math 

def digits(n):
    return math.floor(math.log(n)/math.log(10)) + 1
    pass

def digits(n):
    return len(str(n))
    # Flez


def digits(n):
    k=0
    while n>0:
        n=int(n/10)
        k+=1
    return k
        
        


def digits(n):
    print(type(n))
    if isinstance(n, int):
        return len(str(n))
    
    return 0

def digits(n):
  len_1=0
  while(n!=0):
    n//=10
    len_1+=1
  return len_1


def digits(n):
    print(n)
    z=[int(x)  for x in str(n)]
    # your code here
    print(z)
    return len(z)


def digits(n):
    sum = 0
    for i in str(n):
        sum += 1
    return sum
# Subscribe to ScratchRunning


def digits(n):
    c=0
    while n>0:
        n=n//10
        c=c+1
    return c

def digits(n):
    # your code here
    digits=str(n)
    
    return len(digits)


def digits(n):
    c = 1
    n = n//10
    while n != 0:
        c += 1
        n = n//10
    return c


def digits(n):
  str(n)
  return len(str(n))
    


def digits(n):
    
    n = str(n)
    num = n.count('')-1
    
    return num


def digits(n):
    s = str(n)
    return len([c for c in s])

def digits(n):
    n_str = str(n)
    n_list = n_str.split('.')
    count = len(n_list[0])
    return count

def digits(n):
    # your code here
    i = 0
    while n > 0:
      i+=1
      n = n // 10      
    return i

def digits(n):
    # your code here
    total = 0
    n = str(n)
    for i in n:
        total += 1
    return total

def digits(num):
  count = 0
  
  if num < 10:
    return 1
  else:
    num >= 10
    num_digits = len(str((num)))
    return num_digits

num = 11132424212
print(digits(num))

def digits(num):
    n_digits = 0
    while num > 0:
        num //= 10
        n_digits += 1
    return n_digits

def digits(n):
    count = 0
    while n>0:
        count += 1
        n = n//10
    return count

def digits(n):
    nums = []
    n = str(n)
    for num in n:
        nums.append(n)
    return len(nums)
    pass

def digits(n):
    # your code here
    numar2 = str(n)
    counter = 0
    for i in numar2:
        print(i)
        counter = counter +1
    return counter


def digits(n):
    return range(len(str((abs(n)))))[-1]+1

def digits(n):
    x = len(str(n))
    return int(x)

def digits(n):
    digits = []
    if n>= 0:
       [digits.append(d) for d in str(n)]
    return len(digits)
    pass

def digits(n):
    # your code here
    result = 0
    
    n2 = str(n)
    
    for i in n2:
        result += 1
        
    return result
    
    
    pass

def digits(n):
    # your code here
    if ( n > 0 ):
        return len(str(n))

def digits(n):
    result = len(str(n))
    return result

def digits(n):
    n = str(n)
    count = 0
    for i in n: 
        count += 1
    return count


def digits(n):
    res = len(str(n))
    return(res)

def digits(n):
   if n==0:
       return 1
   ans = 0
   while n!=0:
       n  =  n//10
       ans += 1
   return ans

def digits(n):
    return len(ascii(n))

def digits(n):
    str_n = str(n)
    return len(str_n)

def digits(n):
    m=list(str(n))
    res=len(m)
    return res

def digits(n):
    return (len(str(int(n))))

def digits(n):
    
    
    d = [int(x) for x in str(n)]
    
    l = len(d)
    
    return l
    


def digits(n):
    return sum(1 for i in str(n))

def digits(n):
    n = str(n)
    n = list(n)
    size = len(n)
    return size
    pass

def digits(n):
    return 1 if n < 10 else 1 + digits(n//10)
    pass

def digits(n):

    total = 0
    
    for i in str(n):
        total += 1
    return total

def digits(n):
    # your code here
    q = str(n)
    return len(q)


def digits(n):
    d = 0
    while n >= 1:
        n = n // 10
        d += 1
    
    return d

def digits(n):
    conv = str(n)
    counter = 0
    for i in conv:
        counter += 1
    return counter

def digits(n):
    k=1
    while n//10: 
        k+=1
        n//=10
    return k;

def digits(n):
    if n >= 0:
        n = str(n)
    return len(n)

def digits(n):
    return len(f'{n}')

def digits(n):
    digits_amount = len(str(n))
    return(digits_amount)

def digits(n):
    num=0
    while n>0:
        n=int(n/10)
        num=num+1
    return num

def digits(n):
    number = str(n)
    return len(number)

def digits(n):
    # your code here
    x = str(n)
    y = len(x)
    return y

def digits(n):
    an_integer = n
    a_string = str(an_integer)
    length = len(a_string)
    return length

# your code here


def digits(n):
    return len(str(n))  ## returning no of digits
    ## by first converting it to a string 


def digits(n):
    num_str = str(n)
    var_save = len(num_str)
    return var_save
    pass

import math
def digits(n):
    d = 1
    while n >= 10:
        d += 1
        n = math.floor(n/10)
    return d

def digits(n):
    return len(' '.join(str(n)).split())

def digits(n):
    digit = n
    answer = 1
    while digit >= 10:
        digit = digit /10
        answer += 1
    return answer

def digits(n):
    number = str(n)
    i = 0
    for letter in number:
        i += 1
    return i

def digits(n):
    sum = 0
    while n > 0:
        return len(str(n))

def digits(n):
    for i in str(n).split():
        return len(i)

def digits(n):
    list = [int(x) for x in str(n)]
    return len(list)

def digits(n):
    a = str(n)
    b = list(a)
    for element in b:
        if element == ',' or element == '.':
            b.remove(element)
        else: 
            pass
    return len(b)



def digits(n):
    num = 0
    awnser = 0
    num = str(n)
    awnser = len(num)
    return awnser


def digits(n):

    string =  str(n)
    i = 0
    for s in string:
        i +=1
    return i


def digits(n):
    # your code here
    count = 1
    while(n>=10):
        q = n/10
        count += 1
        n = q
        
    return count

def digits(n):
    total = str(n)
    return len(total)

def digits(n):
    num_digits = 0
    while n > 0:
        n = n // 10
        num_digits += 1
    return num_digits

def digits(n):
    numStr = str(n)
    return len(numStr)