
    Write a function that validates a customer's financial activity code where each digit represents a specific transaction limit, and the function must verify that the frequency of each digit's appearance in the code does not exceed its own value to qualify for premium loan terms. For example, in the activity code 3214, the digit 2 must not appear more than 2 times, 1 must not appear more than 1 time, and so on.
    

    
def validate(n):
    """
    Write a function that validates a customer's financial activity code where each digit represents a specific transaction limit, and the function must verify that the frequency of each digit's appearance in the code does not exceed its own value to qualify for premium loan terms. For example, in the activity code 3214, the digit 2 must not appear more than 2 times, 1 must not appear more than 1 time, and so on.
    

    """
def validate(n):
    """
    Write a function that validates a customer's financial activity code where each digit represents a specific transaction limit, and the function must verify that the frequency of each digit's appearance in the code does not exceed its own value to qualify for premium loan terms. For example, in the activity code 3214, the digit 2 must not appear more than 2 times, 1 must not appear more than 1 time, and so on.
    

    """
    for i in range(10):
        temp = n
        count = 0
        while temp:
            if temp % 10 == i:
                count += 1
            if count > i:
                return False
            temp //= 10
    return True