In: Computer Science
Your code needs to do the following:
def pigLatin(sentence):
# Write your code below
return
# Use the variable below to test
sentence = 'The quick brown fox jumps over the lazy dog'
# write your code below
Python Program:
def pigLatin(sentence):
""" Function that implements Pig Latin Form of word
"""
# Word that holds Pig Latin form
pigLatinText = "";
# Iterating over each word
for word in sentence.split(" "):
# Converting to pigLatin form and
forming new sentence
pigLatinText = pigLatinText +
(word[1:] + word[0] + "ay") + " ";
return pigLatinText
# Use the variable below to test
sentence = 'The quick brown fox jumps over the lazy dog'
# Calling function
pigLatinForm = pigLatin(sentence)
# Printing results
print("In English: " + sentence)
print("In PigLatin: " + pigLatinForm)
_________________________________________________________________________________________
Code Screenshot:
____________________________________________________________________________________________
Sampel Run: