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

Pig Latin challenge

I have recently attempted the pig Latin challenge however it only works for 3 out of 5 test cases(The 2 that don’t work are hidden so I don’t know what is wrong.) Here is my code: Please take a look, thanks!😀 https://code.sololearn.com/c7nzQGwJ1npy/?ref=app Edit: I think it might be that if you only put one letter in, it breaks...

29th Jul 2020, 7:47 PM
HullaBrian
HullaBrian - avatar
5 Answers
+ 2
By this statement : var = var.replace(firstchar,'') If input contains dublicate charecters, that is all equal to firstchar will get replaced by "". So just empty var[0]= "". And store back result..
29th Jul 2020, 8:00 PM
Jayakrishna 🇮🇳
0
I think the issue may be your printing output in separate line... Try this print(var,end ="")
29th Jul 2020, 7:53 PM
Jayakrishna 🇮🇳
0
Sorry, that didn’t seem to fix the problem.
29th Jul 2020, 7:55 PM
HullaBrian
HullaBrian - avatar
0
i also fixed the issue with one letter. That didn’t work either.🤔
29th Jul 2020, 8:00 PM
HullaBrian
HullaBrian - avatar
0
i did do it but the replace method also can be set to work only one time. So i got it to work! Thanks so much.👍
29th Jul 2020, 8:04 PM
HullaBrian
HullaBrian - avatar