Skip to content

Commit a29ea02

Browse files
committed
Update piglatin.py
Moved the separate Pig Latin project into this one.
1 parent ad814e4 commit a29ea02

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

Text/piglatin.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@
77
for more information on rules.
88
"""
99

10-
word = raw_input('What\'s your word? ').lower()
11-
vowels = 'aeiou'
10+
pyg = 'ay'
1211

13-
pig = 'ay'
12+
original = raw_input('Enter a word:')
1413

15-
first = word[0]
16-
17-
if first in vowels:
18-
new = word + pig
14+
if len(original) > 0 and original.isalpha():
15+
word = original.lower()
16+
first = word[0]
17+
if first in ["a","e","i","o","u"]:
18+
new_word = word + pyg
19+
print new_word
20+
else:
21+
new_word = word[1:] + word[0] + pyg
22+
print new_word
1923
else:
20-
new = word[1:] + first + pig
21-
22-
print new
24+
print 'empty'

0 commit comments

Comments
 (0)