-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathM_pig-latin.py
More file actions
29 lines (21 loc) · 863 Bytes
/
M_pig-latin.py
File metadata and controls
29 lines (21 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""
Pig Latin
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"
"""
def rearrange(word):
f = word[0]
return word[1:] + f + "ay"
sentence = input()
words = sentence.split(' ')
pigsentence = [rearrange(word) for word in words]
print(" ".join(i for i in pigsentence))