import math
digits = int(math.log10(n))+1
num = 3452
count = 0
while num != 0:
num //= 10
count += 1
print("Number of digits: " + str(count))
n = 1234 //Any Random Number
digits = len(str(n)) //Saves the number of digits of n into the variable digits
# x: The int number
# n: Digit index
def digit_extraction_by_index(x, n):
return (abs(x) // (10 ** n)) % 10
print(digit_extraction_by_index(123, 0)) # 3
print(digit_extraction_by_index(123, 1)) # 2
n=int(input("Enter number:"))
count=0
while(n>0):
count=count+1
n=n//10
print("The number of digits in the number are:",count)
number = str(input('enter number'))
i = 0
while i in range(len(number)):
i +=1
print(f'Number of digits: {i}')
num = 123456
print(len(str(num)))