Determine whether the given integer N is a Peculiar Number or not | Function to get sum of digits of a number ; Function to check if the number is peculiar ; Store a duplicate of n ; Driver code
def sumDig ( n ) : NEW_LINE INDENT s = 0 NEW_LINE while ( n != 0 ) : NEW_LINE INDENT s = s + int ( n % 10 ) NEW_LINE n = int ( n / 10 ) NEW_LINE DEDENT return s NEW_LINE DEDENT def Pec ( n ) : NEW_LINE INDENT dup = n NEW_LINE dig = sumDig ( n ) NEW_LINE if ( dig * 3 == dup ) : NEW_LINE INDENT return " Yes " NEW_LINE DEDENT else : NEW_LINE INDENT return " No " NEW_LINE DEDENT DEDENT n = 36 NEW_LINE if Pec ( n ) == True : NEW_LINE INDENT print ( " Yes " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) NEW_LINE DEDENT