Skip to content
17 changes: 17 additions & 0 deletions strings/pig_latin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
def pig_latin(sentence):
sentence = sentence.lower()
length = len(sentence)
if sentence[0] in "aeiou":
result = sentence + "way"
else:
for i in range(length):
if sentence[i] in "aeiou":
break
result = sentence[i:] + sentence[:i] + "ay"
return result


statement = input("Enter a string: ")
answer = pig_latin(statement)

print(f'The PIG LATIN of the entered string is "{answer}"')