+ 4

Secret message challenge

The output should be 'svool dliow' (input 'Helo world's) https://code.sololearn.com/cPyRSZl0TJqg/?ref=app

15th Feb 2020, 7:14 PM
Arthur Barbosa
Arthur Barbosa - avatar
29 Réponses
+ 4
v is missing. ;)
15th Feb 2020, 7:23 PM
HonFu
HonFu - avatar
+ 4
My short version of the solution. https://code.sololearn.com/cdNVriqTwTYz/?ref=app
7th Apr 2021, 3:29 PM
Khidr
+ 3
https://code.sololearn.com/cRmiZjDhP42o/?ref=app
1st May 2020, 4:13 AM
Yaswanth
Yaswanth - avatar
+ 3
Simple and efficient code👇👇✌️ : import string inp = (input()).lower() alps = string.ascii_lowercase l1 = [] for i in alps: l1.append(i) # print(l1, inp) count = [] for i in inp: try: count.append(l1.index(i)) except ValueError: count.append(" ") # print(count) str = '' for i in count: try: str += l1[25-i] except TypeError: str += " " print(str)
8th Jan 2022, 3:15 PM
Viren Shah
Viren Shah - avatar
+ 2
Here is my solution: https://code.sololearn.com/cuf2DhV4Z0Us/?ref=app I just made a list of the letters in the alphabet, made a copy of it that was reversed, combined both lists in a dictionary, and replaced each letter in the input with the opposite letter. (Better explained in the code.)
4th Aug 2020, 6:59 PM
McInventor29
McInventor29 - avatar
+ 2
message=input().lower() alph="abcdefghijklmnopqrstuvwxyz" p="" for i in message: for k in range(len(alph)): if i==alph[k]: h=alph[-k-1] p+=h if i==" ": p+=" " continue print(p)
8th Oct 2021, 8:15 PM
Ayodeji Akinkuowo
Ayodeji Akinkuowo - avatar
+ 2
import string x = input().lower() abcd = string.ascii_lowercase dcba = abcd[::-1] dict = dict(zip(abcd,dcba)) res = [dict[i] if i.isalpha() else i for i in x] print("".join(res))
6th Nov 2021, 12:34 AM
Mateo González Bufi
Mateo González Bufi - avatar
+ 2
Why you write so long code? You can do this very easy:::: import string n = input().lower() b = string.ascii_lowercase for i in n: pos = b.find(i) print(b[-pos-1]) Here 6 line) I fix some bags if you can do this yourself 😉😏
17th Mar 2022, 4:35 PM
Anonymous.
+ 1
Thank you!
16th Feb 2020, 9:38 PM
Arthur Barbosa
Arthur Barbosa - avatar
+ 1
https://code.sololearn.com/cymXYyIAz23i/?ref=app
26th Jun 2020, 7:37 PM
Tanush Bhattacharya
Tanush Bhattacharya - avatar
+ 1
Here's a different ASCII solution: https://code.sololearn.com/cW38n9Sc6Ciw/?ref=app
22nd Jul 2020, 5:52 PM
Rasmus Lynge Jacobsen
Rasmus Lynge Jacobsen - avatar
+ 1
Another solution with 2 list https://code.sololearn.com/cCpv60MG4auB/#py
23rd Jul 2020, 4:47 PM
Israel Flores
Israel Flores - avatar
+ 1
alpha = "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ" reversed_alpha = alpha[::-1] message = input() coded = " " for i in message : coded += reversed_alpha[alpha.index(i)] print(coded.lower())
22nd Oct 2021, 10:39 PM
Mas'ud Saleh
Mas'ud Saleh - avatar
3rd Mar 2020, 7:09 PM
Sergei
18th May 2020, 6:18 AM
IrinaKW
IrinaKW - avatar
0
This is the solution for the code coach secret message problem in my version: https://code.sololearn.com/ca17A4a25a0a/#py
11th Jan 2021, 6:17 AM
Venu Gopaal Watada
Venu Gopaal Watada - avatar
0
Thanks for the post. Helped me figure out why I was printing either each inverted letter on a separate line and not being able to combine it into a single line output. https://code.sololearn.com/cA12a16a13A1
22nd Jul 2021, 10:38 AM
Snarkly
Snarkly - avatar
2nd Oct 2021, 10:10 AM
Domilton
0
import re message = input() alfabet = ["a","b","c","d","e","f","g","h", "i", "j", "k", "l", "m", "n", "o","p","q","r","s","t","u","v","w","x","y","z", " "] def cnv_secr(xxx): lst = [] for i in xxx: for index, letter in enumerate(alfabet, start=1): if i.lower() == letter: lst.append(index) string = "" for i in lst: for index, letter in enumerate(alfabet[::-1]): if i == 27: # make do!! letter = ' ' string += letter elif index == i: string += letter print(re.sub(' +', ' ', string)) cnv_secr(message)
3rd Oct 2021, 8:55 PM
Johny Bracker
Johny Bracker - avatar