human
Integers from the range that are composed of a single distinct digit | Boolean function to check distinct digits of a number.
Take last digit.
Check if all other digits are same as last digit.
Remove last digit.
Function to return the count of integers that are composed of a single distinct digit only.
If i has single distinct digit.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to integers from the range that are composed of a single distinct digit and the other steps required.
 def checkDistinct ( x ) :
	last = x % 10
	while ( x ) :
		if ( x % 10 != last ) :
			return False
		x = x // 10
	return True
def findCount ( L , R ) :
	count = 0
	for i in range ( L , R + 1 ) :
		if ( checkDistinct ( i ) ) :
			count += 1
	return count
L = 10
R = 50
print ( findCount ( L , R ) )