human
Find the smallest number whose sum of digits is N | Function to get sum of digits.
Function to find the smallest number whose sum of digits is also N.
Checking if number has sum of digits = N.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to find the smallest number whose sum of digits is N and the other steps required.
 def getSum ( n ) :
	sum1 = 0 ;
	while ( n != 0 ) :
		sum1 = sum1 + n % 10 ;
		n = n // 10 ;
	return sum1 ;
def smallestNumber ( N ) :
	i = 1 ;
	while ( 1 ) :
		if ( getSum ( i ) == N ) :
			print ( i ) ;
			break ;
		i += 1 ;
N = 10 ;
smallestNumber ( N ) ;