repl.it
@SakuraKimiko/

pig latin

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#get sentence from user


original=input("Write a sentence:").strip().lower()


#split sentence into words

words=original.split()
print (words)

new_words=[]


for word in words:
    if word[0] in "aeiou":
        new_word=word+"yay"
        new_words.append(new_word)

        
    else:
        vowel_pos= 0
        for letter in word:
            if letter not in "aeiou":
                vowel_pos=vowel_pos+1
             
            else:
                break
                
        cons = word[:vowel_pos]
        therest=word[vowel_pos:]
        new_word = therest + cons +"ay"
        new_words.append(new_word)
        
        
print (new_words)
        
# if start with vowel , just add yay


# if start with consonant ,move consonants to the end and add ay

# stick word back together

# output final string