PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#create user input for English sentence
English_Sentence = input()
#separate words in string by space and convert into list
List = English_Sentence.split(" ")
#create empty list to add strings to at end of each iteration
Empty_List = []
#create for loop to iterate through List and convert English sentence into PigLatin
for i in List:
y = i #is this necessary?
y2 = y[0] #to get first letter and store in variable so I can remove it but also add on to the end of each string later
y3 = y.replace(y2, "") #to remove first letter
y4 = y3 + y2 + "ay" #to add first letter and "ay" to the string with the first letter removed which is stored in the variable y3
Empty_List.append(y4) #add piglatin string to list for every iteration
print(" ".join(Empty_List)) #convert list into string separated by a space
#please could you give me feedback on how I could improve this - in looking to career change and am studying Python. I'm an électricien at the moment. Thanks for such a wonderful community :)
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run