Count of numbers in a range that does not contain the digit M and which is divisible by M . | Function to count all the numbers which does not contain the digit ' M ' and is divisible by M ; Storing all the distinct digits of a number ; Checking if the two conditions are satisfied or not ; Driver code ; Lower Range ; Upper Range ; The digit
def contain ( L , U , M ) : NEW_LINE INDENT count = 0 NEW_LINE for j in range ( L , U + 1 ) : NEW_LINE INDENT num = set ( str ( j ) ) NEW_LINE if ( j % M == 0 and str ( M ) not in num ) : NEW_LINE INDENT count += 1 NEW_LINE DEDENT DEDENT print ( count ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE L = 106 NEW_LINE U = 200 NEW_LINE M = 7 NEW_LINE INDENT contain ( L , U , M ) NEW_LINE DEDENT