-
Notifications
You must be signed in to change notification settings - Fork 0
/
pig_latin.py
21 lines (21 loc) · 916 Bytes
/
pig_latin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from __future__ import print_function
from common import Quit_Exception, ready_to_quit
puncuation=[',', '.', '?', '!']
vowels=['a','e','i','o','u']
blends=['br','bl','cr','cl','ch','cz','dr','dj','dw','fr','fl','gr','gl','gn','gw','kn','kl','kr','ll','mn','pn','ps','pl','pr','pt','qu','sh','sl','sc','sk','sm','sn','sp','st','sv','sw','sch','scl','scr','spr','squ','str','tr','th','ts','wr','wh'
]
def translate():
print('Tapez Q pour quitter')
sentence=input('traducteur de pig latin \n entre la text\n ')
ready_to_quit(sentence)
words=sentence.split()
for word in words:
if word[0] in vowels:
print(word+'way',end=' ')
elif word[0:3] in blends:
print(word[3:]+word[0:3]+'ay',end=' ')
elif word[0:2] in blends:
print(word[2:]+word[0:2]+'ay',end=' ')
else:
print(word[1:]+word[0]+'ay',end=' ')
print('\n')