tapcode/tapcode.py
def encipher(sentence: str, sep: str = " ") -> str:
    """
    Encipher a sentence with tapcode system

    Args:

        Sentence (String):          sentence
        Sep (String):               Separator(space by default)

    Return:

        String. Enciphered sentences.

    Example:

        >>> encipher("Hello")
        "23 15 31 31 34"
        >>> encipher("", "_")
        "23_15_31_31_34"
    """

    sentence = prepare_sentence(sentence)
    encipheredText = []

    for word in sentence.strip().split(" "):
        for letter in word:
            for i in range(len(polybe)):
                for j in range(len(polybe[i])):
                    if polybe[i][j] == letter:
                        encipheredText.append(str(i+1) + str(j+1))
                        encipheredText.append(sep)

    # This pice of code will add sep to the end of our encipheredText
    # so for remove that we can use output[:-len(sep)]
    # but what if that sep was empty string?
    # 23 = h become 2 then we cant decode the sentence

    # Thats why i wrote this if statement
    if sep:
        return "".join(encipheredText)[:-(len(sep))]
    else:
        return "".join(encipheredText)

    Encipher a sentence with tapcode system

    Args:

        Sentence (String):          sentence
        Sep (String):               Separator(space by default)

    Return:

        String. Enciphered sentences.

    Example:

        >>> encipher("Hello")
        "23 15 31 31 34"
        >>> encipher("", "_")
        "23_15_31_31_34"
    
Encipher a sentence with tapcode system
Encipher a sentence with tapcode system
def encipher(sentence: str, sep: str = " ") -> str:
    sentence = prepare_sentence(sentence)
    encipheredText = []
    for word in sentence.strip().split(" "):
        for letter in word:
            for i in range(len(polybe)):
                for j in range(len(polybe[i])):
                    if polybe[i][j] == letter:
                        encipheredText.append(str(i+1) + str(j+1))
                        encipheredText.append(sep)
    if sep:
        return "".join(encipheredText)[:-(len(sep))]
    else:
        return "".join(encipheredText)
def encipher ( sentence : str , sep : str = " " ) -> str : sentence = prepare_sentence ( sentence ) encipheredText = [ ] for word in sentence . strip ( ) . split ( " " ) : for letter in word : for i in range ( len ( polybe ) ) : for j in range ( len ( polybe [ i ] ) ) : if polybe [ i ] [ j ] == letter : encipheredText . append ( str ( i + 1 ) + str ( j + 1 ) ) encipheredText . append ( sep ) if sep : return "" . join ( encipheredText ) [ : - ( len ( sep ) ) ] else : return "" . join ( encipheredText )
Encipher a sentence with tapcode system
Encipher a sentence with tapcode system
"""
    Encipher a sentence with tapcode system

    Args:

        Sentence (String):          sentence
        Sep (String):               Separator(space by default)

    Return:

        String. Enciphered sentences.

    Example:

        >>> encipher("Hello")
        "23 15 31 31 34"
        >>> encipher("", "_")
        "23_15_31_31_34"
    """ # This pice of code will add sep to the end of our encipheredText # so for remove that we can use output[:-len(sep)] # but what if that sep was empty string? # 23 = h become 2 then we cant decode the sentence # Thats why i wrote this if statement
sentence
str
sep
str
Sentence
None
Sep
Separator(space by default)
Separator ( space by default )
examples
None