human
Find N numbers such that a number and its reverse are divisible by sum of its digits | Function to calculate the sum of digits.
Loop to iterate through every digit of the number.
Returning the sum of digits.
Function to calculate the reverse of a number.
Loop to calculate the reverse of the number.
Return the reverse of the number.
Function to print the first N numbers such that every number and the reverse of the number is divisible by its sum of digits.
Loop to continuously check and generate number until there are n outputs.
Variable to hold the sum of the digit of the number.
Computing the reverse of the number.
Checking if the condition satisfies . Increment the count and print the number if it satisfies ..
Driver code"
How can the above be solved in Python?
 What is a code to find N numbers such that a number and its reverse are divisible by sum of its digits and the other steps required?
assistant
#Here is code to find N numbers such that a number and its reverse are divisible by sum of its digits and the other steps required.
 def digit_sum ( n ) :
	sum = 0
	while ( n > 0 ) :
		m = n % 10 ;
		sum = sum + m ;
		n = n // 10
	return ( sum )
def reverse ( n ) :
	r = 0
	while ( n != 0 ) :
		r = r * 10
		r = r + n % 10
		n = n // 10
	return ( r )
def operation ( n ) :
	i = 1
	count = 0
	while ( count < n ) :
		a = digit_sum ( i )
		r = reverse ( i )
		if ( i % a == 0 and r % a == 0 ) :
			print ( i , end = " ▁ " )
			count += 1
			i += 1
		else :
			i += 1
if __name__ == ' _ _ main _ _ ' :
	n = 10
	operation ( n )