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

Pig Latin

Need help, I don't get it why case#3 and case#5 didn't passed txt = input().split() for i in txt: k = i.replace(i[0],"") + i[0] + 'ay' print(k, end = " ")

15th Jan 2022, 7:15 PM
Timur Askarov
Timur Askarov - avatar
2 Answers
+ 3
I think , this approach of replace function replaces all i[0] in the i (i.e dublicates, for ex : 'aaaabc' replaced by 'bc' just)...
15th Jan 2022, 7:21 PM
Jayakrishna 🇮🇳
0
My solution: woorden = input().split() zin ="" for x in woorden: y = "" firstL = x[0] for i in range(len(x)): if i==0: continue y += x[i] y = y + firstL + "ay" zin += y+" " print (zin)
21st Oct 2022, 7:05 PM
Laurent