Did I complicate too much in this challenge? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Did I complicate too much in this challenge?

I solved "Pig Latin" but I was wondering if there was an easier or simpler way to do it. I want to know this because I want to understand how hard should medium difficulty challenges be. https://code.sololearn.com/c7JrmUVQfdh8/?ref=app

30th Jul 2020, 12:02 AM
HadexGM
2 Réponses
+ 3
1. make a better function name, repl doesnt make any sense and it's better to use a function name that explains what the function is doing. ex toPigLatin(string a) 2. add the "ay" at the end of the string on function repl. i don't understand why you'd add the "ay" when you are about to print it. 3. don't manually loop each string to separate the words, use the split function instead. 4. the added space at the end of the string is unnecessary, there's a way to do it without using them. extra tip: you only need 1 for loop for this challenge, your solution is a bit too inefficient.
30th Jul 2020, 2:09 AM
Shen Bapiro
Shen Bapiro - avatar
0
I see, that would have saved a lot of time and effort. Thank you!
31st Jul 2020, 3:01 AM
HadexGM