Chess Dictionary Validator (Python) (Automate The Boring Stuff)
As you said the code works - there might be additional conditions for a valid board, that you are not checking for which you will be able to expand on using the same structure. I looked up the chapter from the book you mention and your implementation meets the requirements outlined there.
Since this is Python, there are more than one way to implement the requirements, at a minimum I'd recommend refactoring the code to be self documenting instead of relying on comments. This will require only minor refactoring of your code.
Then building on that may be consider taking a functional approach and utilizing python builtins. YMMV - here is my implementation, it is not perfect, but that is not the intent here.
def checkCriteria(pieces, fn, cnt):
    if len(list(filter(fn, pieces))) &gt; cnt:
        return False
    
    return True

def checkValidPositions(input_pos):
    positions = set()
    for col in ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']:
        for row in range(1, 9):
            positions.add(str(row) + col)

    return all(pos in positions for pos in input_pos)

def checkMaxPiecesByColor(pieces):
    return all(checkCriteria(pieces, lambda piece: len(piece) &gt; 0 and piece[0] == ch, 16) for ch in ['w', 'b'])

def checkKingCount(pieces):
    return all(checkCriteria(pieces, lambda piece: piece == king, 1) for king in ['bking', 'wking'])

def checkPawnCount(pieces):
    return all(checkCriteria(pieces, lambda piece: piece == pawn, 8) for pawn in ['bpawn', 'wpawn'])

def checkValidPieces(pieces):
    valid_pieces = set()
    for color in ['w', 'b']:
        for piece in ['pawn', 'knight', 'bishop', 'rook', 'queen', 'king']:
            valid_pieces.add(color + piece)

    return len(pieces - valid_pieces) == 0

def isValidChessBoard(board):
    pieces = board.values()
    positions = board.keys()

    if not checkValidPositions(positions):
        return False
        
    if not checkMaxPiecesByColor(pieces):
        return False
    
    if not checkKingCount(pieces):
        return False
        
    if not checkPawnCount(pieces):
        return False
    
    if not checkValidPieces(set(pieces) - set([''])):
        return False
    
    return True