human
Can you provide a code to count all numbers up to N having M as the last digit and the other steps required given the following:
Count all numbers up to N having M as the last digit | Function to count the numbers ending with M.
Stores the count of numbers required.
Calculate count upto nearest power of 10.
Computing the value of x.
Adding the count of numbers ending at M from x to N.
Driver Code.
Function call"
How can the above be solved in Python?
assistant
#Here is code to count all numbers up to N having M as the last digit and the other steps required.
 def getCount ( N , M ) :
	total_count = 0
	total_count += N // 10
	x = ( N // 10 ) * 10
	if ( ( N - x ) >= M ) :
		total_count = total_count + 1
	return total_count
N = 100
M = 1
print ( getCount ( N , M ) )