def encode(array, encoding):
    """Encodes 'array' with the encoding specified in encoding.
    This value must be a dictionary"""
    encoded = []
    for i in array:
        encoded.append(encoding[i])
    return encoded