Having issues with my English to PigLatin Converter. I can get the code to execute correctly on one word but once i do 2 or more words it adds the first letter [0] + 'ay' to the last word in the line.... any suggestions?
def main():
# Create a list of words
words = []
# user input a sentence.
sentence = input("Please enter a sentence in english to convert to 'Pig Latin': ")
# for loop that splits up sentence and appends it to words list
for wrd in sentence.split():
wrd = words.append
# Display the Sentence in english to the user
print("Here is the sentence you entered: ", sentence)
# Dsiplay the new sentence in PigLatin
print(PigLatinConverter(sentence))
def PigLatinConverter(words):
# Create a for loop to iterate of words
for i in range(len(words)):
# Add the first letter and ay to the end
PigLatin = words[1:] + words[0] + "ay"
# return PigLatin to main function
return PigLatin
# Calls the main function to execute
main()