-
-
Save jarhill0/88849142fab993c7a4e5b4cde46fecba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pyg_sentence(sentence): | |
new_sentence = "" | |
for word in sentence: | |
new_sentence += pyg(word) | |
return new_sentence | |
def pyg(x): | |
if x[0] == 'a' or x[0] == 'e' or x[0] == 'i' or x[0] == 'o' or x[0] == 'u': | |
new_word = ' ' + x + "ay" | |
elif x[1] != 'a' and x[1] != 'e' and x[1] != 'i' and x[1] != 'o' and x[1] != 'u': | |
stem = ' ' + x[2:] | |
beg = x[0:2] | |
new_word = stem + beg + "ay" | |
else: | |
stem = ' ' + x[1:] | |
beg = x[0] | |
new_word = stem + beg + "ay" | |
return new_word | |
raw_sentence = input("enter a sentence:") | |
Sentence = raw_sentence.split() | |
print(pyg_sentence(Sentence)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment