Skip to content
Related Articles

Related Articles

Improve Article

Cryptophasia Code in Python

  • Last Updated : 10 Jul, 2020

Cryptophasia is a language that is created and spoken between twins before they learn their own mother tongue. Since no one knows that language, it still remains a secret. As humans never left a stone unturned, Scientists have found that this language is created, just by mispronouncing the existing language that we all know. Doesn’t this remind you about encryption? Yes, it’s quite similar. All we need to do is, change a few grammatical rules of a particular language so that the reader should know these rules in order to decrypt them.

Technique Used

As we all know, we could still read a misspelled word correctly, if their first and last alphabets are right. So, this explains the importance of the first and the last alphabets in a word in reading it properly. Cryptophasia wisely uses this technique, to encrypt a word. It changes the first and the last alphabets of a word and encrypts it. Now let’s see the rules that are been followed to achieve this state, so that no one can decrypt these words, except those who know these rules.


  • Remove the first alphabet of the word. See the below example 
apple --> pple
  • Append this first alphabet to the end of the word.
pple --> pplea
  • Append the string ‘ay’ to the end of the word.
pplea --> ppleaay

The word ‘apple’ has been encrypted into ‘ppleaay’. In this way, any word can be encrypted into an unknown form, making it difficult for the reader to understand it.


Before coding, we should be aware that the input can be of any form. They may contain uppercase and lowercase alphabets, special characters, spaces, and numbers. In order to encrypt it efficiently, we won’t be using uppercase alphabets and special characters. Because when these uppercase and special characters are present in the word, it can even provide a clue to the reader about the word.

A few cases can be as follows:

  • Uppercases mostly occur at the start of the word. This can give them a clue about the starting alphabet.
  • Some special characters are specifically used in a few formats only like @ in E-Mail IDs, + in phone numbers, etc.

This makes us realize that it’s really needed to:

  • Convert uppercase into lowercase alphabets.
  • Remove special characters.

Since strings are immutable, it is quite difficult to make changes in a given word. So, it’s highly essential to convert the string into a list that is mutable. In our program, since we are playing with alphabets of a word, splitting the alphabets of the word as well into a list plays an important role.

Below is the implementation.


# Cleaning & Converting Text into List
def CleConvStr2List(text):
    A, B, C = ([] for i in range(3))
    # Split line into words
    A = text.split()
    # Removing special chars from word
    for i in range(len(A)):
        B.append(''.join(e for e in A[i] if e.isalnum()))
    while('' in B):
    # Split word into chars
    for i in range(len(B)):
    return C
# Performing Cryptophasia
def Cryptophasia(text):
    C = []
    C = CleConvStr2List(text)
    for i in range(len(C)):
        del C[i][0]
    D = []
    word = ''
    for i in range(len(C)):
    return " ".join(D)
# Driver Code



 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :