(pt, key, symbols="ABCDEFGHIJKLMNOPQRSTUVWXYZ")
return "".join(ct)
Performs the substitution cipher encryption on plaintext ``pt``, and returns the ciphertext.

    Assumes the ``pt`` has only letters taken from ``symbols``.
    Assumes ``key`` is a permutation of the symbols. This function permutes the
    letters of the plaintext using the permutation given in ``key``.
    The decription uses the inverse permutation.
    Note that if the permutation in key is order 2 (eg, a transposition) then
    the encryption permutation and the decryption permutation are the same.

    Examples
    ========

    >>> from sympy.crypto.crypto import alphabet_of_cipher, encipher_substitution
    >>> symbols = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    >>> A = alphabet_of_cipher(symbols)
    >>> key = "BACDEFGHIJKLMNOPQRSTUVWXYZ"
    >>> pt = "go navy! beat army!"
    >>> encipher_substitution(pt, key)
    'GONBVYAEBTBRMY'
    >>> ct = 'GONBVYAEBTBRMY'
    >>> encipher_substitution(ct, key)
    'GONAVYBEATARMY'
Performs the substitution cipher encryption on plaintext ``pt``, and returns the ciphertext.
Performs the substitution cipher encryption on plaintext pt and returns the ciphertext .
def encipher_substitution(pt, key, symbols="ABCDEFGHIJKLMNOPQRSTUVWXYZ"):
    """
    Performs the substitution cipher encryption on plaintext ``pt``, and returns the ciphertext.

    Assumes the ``pt`` has only letters taken from ``symbols``.
    Assumes ``key`` is a permutation of the symbols. This function permutes the
    letters of the plaintext using the permutation given in ``key``.
    The decription uses the inverse permutation.
    Note that if the permutation in key is order 2 (eg, a transposition) then
    the encryption permutation and the decryption permutation are the same.

    Examples
    ========

    >>> from sympy.crypto.crypto import alphabet_of_cipher, encipher_substitution
    >>> symbols = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    >>> A = alphabet_of_cipher(symbols)
    >>> key = "BACDEFGHIJKLMNOPQRSTUVWXYZ"
    >>> pt = "go navy! beat army!"
    >>> encipher_substitution(pt, key)
    'GONBVYAEBTBRMY'
    >>> ct = 'GONBVYAEBTBRMY'
    >>> encipher_substitution(ct, key)
    'GONAVYBEATARMY'

    """
    symbols = "".join(symbols)
    A = alphabet_of_cipher(symbols)
    n = len(A)
    pt0 = [x.capitalize() for x in pt if x.isalnum()]
    ct = [key[A.index(x)] for x in pt0]
    return "".join(ct)
def encipher_substitution ( pt , key , symbols = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) : symbols = "" . join ( symbols ) A = alphabet_of_cipher ( symbols ) n = len ( A ) pt0 = [ x . capitalize ( ) for x in pt if x . isalnum ( ) ] ct = [ key [ A . index ( x ) ] for x in pt0 ] return "" . join ( ct )