If index = 1 , any digit from [ 1 - 9 ] can be placed . If N = 1 , 0 also can be placed .
if ( index == 1 ) : NEW_LINE INDENT for digit in range ( ( ( 0 , 1 ) [ N == 1 ] ) + 1 , 10 , 1 ) : NEW_LINE INDENT val += countOfNumbers ( index + 1 , sum + digit , N ) NEW_LINE DEDENT DEDENT