VOWELS = ('a','e','i','o','u','A','E','I','O','U')
word = input("Welcome to the Pig Latin translator, simply enter a word and the translator will return the word in Pig Latin. Insert your word below. \n> ")
def pigLatin(word):
if word[0] in VOWELS:
print (word + 'ay')
else:
print (word[1:] + 'ay')
pigLatin(word)
playAgain = input("Would you like to play again? \n> ")
def secondGame(playAgain):
if playAgain == ('yes'):
second = input("Enter your next word below \n> ")
pigLatin(second)
elif playAgain == ('no'):
print ('Thanks for playing!')
else:
print ('Error: Please respond with a yes or no answer.')
secondGame(playAgain)________________________________________________________________________________________________Above is my code. It runs fine. I basically just had it run through a second time using the secondGame function I made. This still ends the game after only two words have been entered (if you choose the yes option to play again).
My question is - What would be a better way to loop this program? I want it to continue allowing me to enter words into the program until I tell the program "no" - I do not want to play again.
Please help!
Thanks,
bstocks
