Pig Latin in Python 2/5 Tests Failed | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Pig Latin in Python 2/5 Tests Failed

I'm not sure what I'm missing. In the cases that aren't hidden and one that is. I've got them right. Two of the hidden one's are wrong so I can't find the problem. Please can you look at my code and help me. Thanks https://code.sololearn.com/ccR5HYVL3qIF/?ref=app

12th Oct 2020, 12:16 PM
Chey Brown
Chey Brown - avatar
4 Answers
+ 6
sentence = input().split() print(" ".join(w[1:] + w[0] + "ay" for w in sentence)) Pig Latin answer 👆
11th Jun 2021, 2:49 PM
Tharul Nejana
Tharul Nejana - avatar
+ 2
This is the easiest answer...just append what u need in empty list and join them to make a string from list name = input() n = [] for i in name.split(" "): n.append(i[1:] + i[0] + "ay" + " ") print("".join(n))
25th Jan 2021, 4:50 AM
Taral Patel
Taral Patel - avatar
+ 1
you can change it to y4 = y[1:] + y2 + "ay" and remove y3 = y.replace(y2, "") thanks for commenting your code, well done.
12th Oct 2020, 1:18 PM
Bahhaⵣ
Bahhaⵣ - avatar
0
Thanks. Please could explain why changing that makes it work. Since my code still translates the English Sentence into Pig Latin
13th Oct 2020, 3:35 AM
Chey Brown
Chey Brown - avatar