Can anyone tell me why is my code considered wrong by the app while it actually works fine. And is there any better way to do it | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can anyone tell me why is my code considered wrong by the app while it actually works fine. And is there any better way to do it

My personal attempt of solving the code coach challenge of "secret message" https://code.sololearn.com/c9pCtf52k9DV/?ref=app Task: Create a program that replaces each letter in a message with its corresponding letter in a backwards version of the English alphabet.

31st Aug 2021, 10:33 PM
Aziz Mhenni
Aziz  Mhenni - avatar
3 Answers
+ 2
Your code looks fine. I managed to pass it with my code, but with a different method. Without being able to see what the test cases are, it is hard to say. My method strips out numbers, though. so: 123hello gives 123svool in your code and only gives svool in mine. I don't know if this is the case, but I think your implementation is actually better. But mine passed the test. So how about stripping out the numerals? https://code.sololearn.com/c1Zy6PssOpAc/?ref=app
1st Sep 2021, 3:26 AM
Bob_Li
Bob_Li - avatar
+ 1
Bob_Li Well, thank you. I found the problem: it turned out that i forgot to use the lower() function in the 10th line but i fixed it. And i'll leave it here so anyone can benefit from it. It works fine now.
1st Sep 2021, 12:24 PM
Aziz Mhenni
Aziz  Mhenni - avatar
+ 1
Great. I didn't try to test with uppercase. So my buggy code which strips numerals passed too. Loophole in the test cases?
1st Sep 2021, 12:44 PM
Bob_Li
Bob_Li - avatar