+ 1
Space issue in Secret Message Challenge
I have been trying to get this to work for days but can't get this to work with spaces in a sentence. I have tried splitting the input but the join method keeps failing. Any help would be appreciated. import string phrase = str(input()) sentence = string.ascii_lowercase key = dict(zip(sentence,sentence[::-1])) key[" "]=" " print("".join(map(key.get,phrase)))
2 Antworten
+ 1
Mmm. What about using conditions to determine if the char is a space or not?
Btw, try to put the space = space line before the key dict line and give it a try!
0
Refer this code to get the solution:
https://code.sololearn.com/ca17A4a25a0a/#py