repl.it
@AlexArt/

Pig Latin Translator

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
print('Enter a word in either Pig Latin or English')
word = str(input())
ad = 0
if(word[len(word)-2:] == 'ay' and len(word) > 3):
  for i in range(len(word)):
    if(word[i] == ' '):
      ad = 1
      fw = word[:i]
      sw = word[i+1:]
      print('"' + word + '" is in Pig Latin')
      print('In English it would be "' + fw[len(fw)-3]+fw[:len(fw)-3] + ' ' + sw[len(sw)-3]+sw[:len(sw)-3] + '"')
  if(ad == 0):
    print('"' + word + '" is in Pig Latin')
    print('In English it would be "' + word[len(word)-3]+word[:len(word)-3] + '"')
else:
  for i in range(len(word)):
    if(word[i] == ' '):
      ad = 1
      fw = word[:i]
      sw = word[i+1:]
      print('"' + word + '" is not in Pig Latin')
      print('In Pig Latin it would be "' + fw[1:]+fw[0]+'ay' + ' '  + sw[1:]+sw[0]+'ay''"')
  if(ad == 0):
    print('"' + word + '" is not in Pig Latin')
    if(word[0] == 'a'):
      print('In Pig Latin it would be "' + word+'hay" or "' + word+'yay" or "' + word+'way"')
    elif(word[0] == 'e'):
       print('In Pig Latin it would be "' + word+'hay" or "' + word+'yay" or "' + word+'way"')
    elif(word[0] == 'i'):
       print('In Pig Latin it would be "' + word+'hay" or "' + word+'yay" or "' + word+'way"')
    elif(word[0] == 'o'):
       print('In Pig Latin it would be "' + word+'hay" or "' + word+'yay" or "' + word+'way"')
    elif(word[0] == 'u'):
       print('In Pig Latin it would be "' + word+'hay" or "' + word+'yay" or "' + word+'way"')
    else:
      print('In Pig Latin it would be "' + word[1:]+word[0]+'ay' + '"')
Fetching token
?