Skip to content

Commit a51daa4

Browse files
committed
Added Piglatin scripts
1 parent c1177ca commit a51daa4

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Piglatin_Translator/piglatin.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
original = input("Enter a Sentence: ").strip().lower()
2+
words = original.split()
3+
new_words = []
4+
for word in words:
5+
if word[0] in "aeiou":
6+
new_word = word + "yay"
7+
new_words.append(new_word)
8+
else:
9+
vow_pos = 0
10+
for letter in word:
11+
if letter not in "aeiou":
12+
vow_pos = vow_pos + 1
13+
else:
14+
break
15+
cons = word[:vow_pos]
16+
rest = word[vow_pos:]
17+
new_word = rest + cons +"ay"
18+
new_words.append(new_word)
19+
output = " ".join(new_words).capitalize()
20+
print(output)
21+
22+
23+
24+

0 commit comments

Comments
 (0)