Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. VOWELS = ('a', 'e', 'i', 'o', 'u','y','A','E','I','O','U','Y')
  2. AY = 'ay'
  3. def main():
  4.     phrase = input('Enter an English phrase:')
  5.     splitPhrase = phrase.split()
  6.     count = 0
  7.     newPhrase = []
  8.     while count < len(splitPhrase):
  9.         letterOne = splitPhrase[count][0]
  10.         currentLetter = splitPhrase[count]
  11.         if letterOne in VOWELS:
  12.             translatedWord = (currentLetter+ AY)
  13.             newPhrase.append(translatedWord)
  14.         else:
  15.             translatedWord = (currentLetter[1:] + currentLetter[0] + AY)
  16.             newPhrase.append(translatedWord)
  17.             count+= 1
  18.         sep = ' '
  19.         translatedPhrase = ('Translated: ' + sep.join(newPhrase))
  20.     print(translatedPhrase)
  21. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement