Number of n | Returns factorial of n ; returns nCr ; Driver code
def fact ( n ) : NEW_LINE INDENT res = 1 NEW_LINE for i in range ( 2 , n + 1 ) : NEW_LINE INDENT res = res * i NEW_LINE DEDENT return res NEW_LINE DEDENT def nCr ( n , r ) : NEW_LINE INDENT return fact ( n ) // ( ( fact ( r ) * fact ( n - r ) ) ) NEW_LINE DEDENT n = 2 NEW_LINE print ( " Number ▁ of ▁ Non - Decreasing ▁ digits : ▁ " , nCr ( n + 9 , 9 ) ) NEW_LINE