0
Mobile Challenge
There is a mobile challenge in Ruby for pig-latin. I have built the code in the playground and solved the problem, however, the mobile site wont accept my code as the correct answer. Any help would be appreciated, thanks! https://code.sololearn.com/cJ8A2SaZWy1J/?ref=app
2 Antworten
+ 2
Maybe there is something wrong in your logic. Can you share your code so that we can check.
+ 1
It looks like your solution works fine. It also looks like you may be over complicating it. You can achieve this challenge in just a few lines of code.
Your input is fine.
Then just use a variable to hold the output string.
try using a for-in loop instead of 2 while loops.
inside the loop use slicing to create the word in piglatin and append it to the output string
print the output string (Hint use .rstrip to remove trailing whitespace)