Secret Message in Python | Assignment Expert

Problem statement:

We need to create a secret message in Python by mirroring a string. We will be given a string, first, we need to convert it to lowercase, then we need to find its mirror string. How? We need to break 26 alphabets into two half-equal parts, and place them above one another, now check what is the first letter of your string, check that letter in the two half parts of the alphabets, and find its mirror letter. Check the image below for a better understanding.

For example, for copyassignment, the output will be=> xlkbzhhrtmnvmg.

Secret Message in Python, alphabets mirror

Code for Secret Message in Python:

# declaring a string
mystr = 'CopyAssignment'

#making mystr to lower case
mystr = mystr.lower()

# storing alphabets in two half parts, to be used for mirroring
alphabets1 = 'abcdefghijklm'
alphabets2 = 'zyxwvutsrqpon'

# declaring a list to store new string letters
strlist = []

# looping over string
for i in mystr:
    # declaring a counter
    ctr = 0
    if i in alphabets1:
        for j in alphabets1:
            if i==j:
                ctr += 1
        for j in alphabets2:
            if i==j:
                ctr += 1

# printing the list by conerting it to string


Output for Secret Message in Python | Assignment Expert

Also Read:

Avatar of Harry

Author: Harry

Hello friends, thanks for visiting my website. I am a Python programmer. I, with some other members, write blogs on this website based on Python and Programming. We are still in the growing phase that's why the website design is not so good and there are many other things that need to be corrected in this website but I hope all these things will happen someday. But, till then we will not stop ourselves from uploading more amazing articles. If you want to join us or have any queries, you can mail me at Thank you