human
What is a code to check if the sum of distinct digits of two integers are equal and the other steps required given the following:
Check if the sum of distinct digits of two integers are equal | Function to return the sum of distinct digits of a number.
Take last digit.
If digit has not been used before.
Set digit as used.
Remove last digit.
Function to check whether the sum of distinct digits of two numbers are equal.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to check if the sum of distinct digits of two integers are equal and the other steps required.
 def distinctDigitSum ( n ) :
	used = [ False ] * 10
	sum = 0
	while ( n > 0 ) :
		digit = n % 10
		if ( not used [ digit ] ) :
			used [ digit ] = True
			sum += digit
		n = n // 10
	return sum
def checkSum ( m , n ) :
	sumM = distinctDigitSum ( m )
	sumN = distinctDigitSum ( n )
	if ( sumM == sumN ) :
		return " YES "
	return " NO "
if __name__ == " _ _ main _ _ " :
	m = 2452
	n = 9222
	print ( checkSum ( m , n ) )