def password_okay_by_char_count(pwd_row):
    """ 
    Process list of rows from a file, where each row contains pwd policy and pwd.
    Pwd is only valid if the indicated character is found between x and y times (inclusive) in the pwd.

    E.g. 5-7 z: qhcgzzz
    This pwd is invalid, since z is only found 3 times, but minimum is 5.
    """
    
    # Each input row looks like "5-7 z: qhcgzzz"
    # Convert each row to a list that looks like ['5-7 z', 'qhcgzzz']
    pwd_policy_and_pwd = [item.strip() for item in pwd_row.split(":")]
    #print(pwd_policy_and_pwd)

    pwd = pwd_policy_and_pwd[1]
    char_counts, _, char_match = pwd_policy_and_pwd[0].partition(" ")
    min_chars, _, max_chars = char_counts.partition("-")
    
    actual_char_count = pwd.count(char_match)
    if (actual_char_count < int(min_chars)) or (actual_char_count > int(max_chars)):
        return False

    return True