Python program to Detect Number of Digits in an Integer

x = int(input("Insert multiple integer numbers: "))
x = abs(x)
count = 1;
x //= 10
while x > 0:
 x//=10
 count += 1
print("The number of integer(s) is: ",count)

 

 

Output:

Insert multiple integer numbers: 125
The number of integer(s) is:  3

 

Insert multiple integer numbers: 1257
The number of integer(s) is:  4

Subscribe For Daily Updates