Program to count digits in an integer ( 4 Different Methods ) | Recursive Python program to count number of digits in a number ; Driver Code
def countDigit ( n ) : NEW_LINE INDENT if n / 10 == 0 : NEW_LINE INDENT return 1 NEW_LINE DEDENT return 1 + countDigit ( n // 10 ) NEW_LINE DEDENT n = 345289467 NEW_LINE print ( " Number ▁ of ▁ digits ▁ : ▁ % ▁ d " % ( countDigit ( n ) ) ) NEW_LINE