Missing output | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Missing output

https://sololearn.com/compiler-playground/cJ0RdKP9fl4l/?ref=app I'm trying the secret message code coach, but it is saying there is no output. What am I doing wrong? Also, as a side note, my code looks really inefficient. Is there a way to make it more efficient? (Idk if that leads you to my code or just the code coach)

20th Apr 2024, 7:03 PM
Dominic Hetrick
Dominic Hetrick - avatar
5 Answers
+ 3
Dominic Hetrick , there are some major issues in the code. i have currently not checked all of them: > an input sample in this code coach exercise contains *capital letters*. your code does not handle this. > the sample also shows *whitespaces*, these are also not handled by your code. > an other issue is the way the variables *alphabet* and *reverseAlphabet* are created. they are split(), but since there are no spaces in the alphabets, the result will be lists like['abcd...xyz']. using the *in* operator with these lists can not find any letter. so your output will be an empty string. you can omit split(), just use simple strings with the respective letters. => you should rework the reverse function completely. try to fix these issues, then run the code again.
20th Apr 2024, 8:06 PM
Lothar
Lothar - avatar
+ 3
Dominic Hetrick , this sounds great. so if your code is working correct now, you could add "[SOLVED]" in the headline of your post.
20th Apr 2024, 8:44 PM
Lothar
Lothar - avatar
+ 1
please copy-paste your code in a script on playground and link it. we cannot see what you wrote in code coach.
20th Apr 2024, 7:21 PM
Lisa
Lisa - avatar
+ 1
I didn't rework the reverse function, but thank you for pointing out my blunder with the split() function, that allowed me to see how my program was failing in other regions so that I could fix them.
20th Apr 2024, 8:40 PM
Dominic Hetrick
Dominic Hetrick - avatar
0
Ok
20th Apr 2024, 8:50 PM
Dominic Hetrick
Dominic Hetrick - avatar