+ 2

Can't understand code coach Secret message

You are trying to send a secret message, and you've decided to encode it by replacing every letter in your message with its corresponding letter in a backwards version of the alphabet. What do your messages look like? Task: Create a program that replaces each letter in a message with its corresponding letter in a backwards version of the English alphabet. Input Format: A string of your message in its normal form. Output Format: A string of your message once you have encoded it (all lower case). Sample Input: Hello World Sample Output: svool dliow How is this possible??

4th Nov 2020, 1:10 PM
Aradhay Mathur
Aradhay Mathur - avatar
10 Réponses
+ 5
Starting from A we count 1+6 more alphabets to reach H Now if we move 7 letters back starting from Z we get Z,Y,X,W,V,U,T and finally S
4th Nov 2020, 1:14 PM
Abhay
Abhay - avatar
+ 3
Why do you think its not possible.. Any points???
4th Nov 2020, 1:12 PM
Steve Sajeev
Steve Sajeev - avatar
+ 3
"encode it by replacing every letter in your message with its corresponding letter in a backwards version of the alphabet." Couldn't say it any clearer
4th Nov 2020, 2:14 PM
Benjamin Jürgens
Benjamin Jürgens - avatar
+ 2
[I'm new in 2022, it's take my 3hr, but i solved it painful:] 🥱🥱 import string txt = str(input()) txte = txt.lower() alphab = list(string.ascii_lowercase) #print(alphab[::-1][7]) for t in txte.split(" "): oupt = "" for j in t: for i in range(0,len(alphab)): if j == alphab[i]: oupt+=alphab[::-1][i] print(oupt,end=" ")
2nd Feb 2022, 7:34 AM
Moussa Diallo
Moussa Diallo - avatar
+ 2
inp = input().lower() az = 'abcdefghijklm nopqrstuvwxyz' enc = dict(zip(az,az[::-1])) print (''.join([enc[i] for i in inp]))
1st Jan 2023, 4:55 PM
Egor Erofeev
Egor Erofeev - avatar
0
Steve Sajeev I can't understand how that result comes from string "Hello World"
4th Nov 2020, 1:14 PM
Aradhay Mathur
Aradhay Mathur - avatar
0
Thanks Everyone
4th Nov 2020, 1:20 PM
Aradhay Mathur
Aradhay Mathur - avatar
0
So it is only an simple encryption program only.
4th Nov 2020, 2:48 PM
Aradhay Mathur
Aradhay Mathur - avatar
0
alphabet="abcdefghijklmnopqrstuvwxyz" ms= input().lower() coded_ms='' for x in range(len(ms)) : for z in range(len(alphabet)): if alphabet[z]==ms[x]: coded_ms+=alphabet[-z-1] if ms[x]==' ' : coded_ms +=' ' print (coded_ms)
25th Oct 2021, 2:23 AM
youssef
youssef - avatar
0
import string l=str(string.ascii_lowercase) s=(input().lower()).split(" ") li=[] r="" #print(abs(9)) for i in l: li.append(i) for j in s: for i in j: n=li.index(i) r+=li[-abs(n+1)] r+=" " print(r)
23rd Jan 2023, 5:52 PM
Sai Teja
Sai Teja - avatar