How to solve the secret message code coach using chr() and ord()? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to solve the secret message code coach using chr() and ord()?

I solved this coach a month ago using dictionary and now i want to solve it in this way. The wrong thing is: If you enter "o", it shows "l" But when you enter "Sololearn" It shows hoooo.... Please help

1st Aug 2020, 11:25 AM
Baratov Hojiakbar
Baratov Hojiakbar - avatar
3 Answers
+ 5
From my point of view, the issue is using replace(), as this replaces all occurrencies of a character. There are replacements that are correct, but others are done by accident. You can visualize what really happens by using this website. copy your code and paste it there, then perform "Visualize Execution". http://www.pythontutor.com/visualize.html#
1st Aug 2020, 1:17 PM
Lothar
Lothar - avatar
+ 1
The problem is causing like You give Input : aba Process: zbz zxa Output: zxa (should be zxz) Also your ASCII values are not correct.
1st Aug 2020, 12:46 PM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 1
Thank you for helping. All the test cases worked. https://code.sololearn.com/cu7Ykq7ltPh3/?ref=app
1st Aug 2020, 2:46 PM
Baratov Hojiakbar
Baratov Hojiakbar - avatar