Python Program to Count Number of Digits in a Number

num = 3452
count = 0
while num != 0:
    num //= 10
    count += 1
print("Number of digits: " + str(count))

OUTPUT:

Number of digits: 4

Sharing Is Caring

Leave a Comment