from typing import List
from typing import Dict


def convert_words_to_codes(words: List[str], word2code: Dict[str, int]) \
        -> List[int]:
    """Convert list of words to list of codes.

    Args:
        words (list of str): words to convert.
        word2code (dict of str to int): dictionary mapping word to code.

    Returns:
        list of int: list of converted codes.
    """
    unknown_code = word2code['<UNK>']
    return list(map(lambda x: word2code.get(x, unknown_code), words))