Simplify Pig latin code

You have two friends who are speaking Pig Latin to each other! Pig Latin is the same words in the same order except that you take the first letter of each word and put it on the end, then you add 'ay' to the end of that. ("road" = "oadray") Task Your task is to take a sentence in English and turn it into the same sentence in Pig Latin! Input Format A string of the sentence in English that you need to translate into Pig Latin. (no punctuation or capitalization) Output Format A string of the same sentence in Pig Latin. Sample Input "nevermind youve got them" Sample Output "evermindnay ouveyay otgay hemtay" https://code.sololearn.com/cwVk56LaR7we/?ref=app

27th Jun 2022, 8:55 AM
T(Ali)ebi - avatar
2 Answers
+ 3
maybe there is simplier version but i dont use python very frequently words = input().split(); sentence = ''; for word in words: sentence += word[1:] + word[0:1] + 'ay ' print(sentence[:len(sentence) - 1])
27th Jun 2022, 9:09 AM
Мартин 😑🎵
Мартин 😑🎵 - avatar
+ 2
one liner , not much readable maybe but hopefully it helpe you somehow .. a="nevermind youve got them" print(" ".join(list(i[1:]+i[0]+"ay" for i in a.split(" "))))
27th Jun 2022, 9:14 AM
Abhay - avatar