from typing import Dict
from typing import List


def isValidWord(word: str, hand: Dict[str, int], wordList: List[str]) -> bool:
    """Verify if word answer is in wordList and in hand
    
    Does not mutate hand or wordList.

    Args:
        word: guest user
        hand: current letter in a hand
        wordList: valid list of all words

    Returns:
        bool: True if word is in the wordList and is entirely
        composed of letters in the hand. Otherwise, returns False.
    """
    cp_hand = hand.copy()

    if word not in wordList:
        return False

    for char in word:
        if cp_hand.get(char, 0) < 1:
            return False
        else:
            cp_hand[char] = cp_hand.get(char,0) - 1

    return True
    # one line:
    # return word in wordList and all(word.count(c) <= hand.get(c, 0) 
    #                                               for c in word) # Kiwitrader