Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sentence = input("What sentence do you want to translate to Pig Latin? ")
- sentence = sentence.split()
- sentence_pigified = ""
- clusters = {"bl", "cl", "fl", "gl", "pl", "sl", "br", "cr", "dr", "fr", "gr", "pr", "tr", "sc", "sk", "sm", "sn", "sp", "st", "sw", "tw"}
- consonants = {"b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "x", "z", "w", "y"}
- vocals = {"a", "e", "i", "o", "u"}
- for word in list(sentence):
- if word[0] in vocals:
- sentence_pigified += (word + "ay") + " "
- if word[:2] in clusters:
- sentence_pigified += (word[2:] + word[:2] + "ay") + " "
- elif word[0] in consonants:
- for i in word:
- if i in vocals:
- sentence_pigified += (word[word.find(i):] + word[:word.find(i)] + "ay") + " "
- break
- print(sentence_pigified)
Add Comment
Please, Sign In to add comment