def count_digit(k, n):
    """
    Count the number of k's between 0 and n. k can be 0 - 9.

    :param k: given digit
    :type k: int
    :param n: given number
    :type n: int
    :return: number of k's between 0 and n
    :rtype: int
    """
    count = 0
    for i in range(n + 1):
        # treat number as string
        # count digit character in the string
        count += str(i).count(str(k))
    return count