+ 2
Why is this Pig Latin solution wrong?
I've solve the Pig Latin in Python in a couple of ways. These ways were using a variable to save the words translation and were passing the Test 1, 2 and 5 correctly. Despite that I tried by slicing the input then printing the words and it worked that way. Yet I want to know why my first solving wasn't correct and if it's a good solution in terms of software quality. https://code.sololearn.com/c91kDatvjR6s/?ref=app
9 Answers
+ 2
The first letter is deleted in the whole word and only once added at the end plus the ay.
+ 1
I got an unexpected result for input "aa"
Output is: aay
Expected is: aaay
+ 1
Or this one
Input: aba
Output: baay
Expected: baaay
+ 1
Coding Cat [Mouse searching] Oh I got it Now
+ 1
Thanks for answering. Now I know why that wasn't working in those tests. I had to debug it better.
+ 1
JhMont Check this out
https://code.sololearn.com/ct3QJG1zFx43/?ref=app
+ 1
x=""
for i in input().split():
x += i[1:] + i[0] + "ay "
print (x)
0
It may come from the space after the string you add, "ay ", which could add an extra space at the end of the output string ?