Massive python noob here.
I've amended the Pig Latin Translator to include incorrect two word inputs, an incorrect empty string and a string with letters in it incorrectly. I have added raw_input('Enter a word: ') after the incorrect input conditions in the hope this would then cause a loop.
How can I loop back to the top if the condition is not met? The condition being that a single word is entered so the Pig Latin Translator can translate it.
print '\nWelcome to the Pig Latin Translator!\n' pyg = 'ay' original = raw_input('Enter a word: ') if len(original) > 0 and original.isalpha(): word = original.lower() first = word new_word = word + first + pyg new_word = new_word[1:len(new_word)] print '\n', 'In Pig Latin this is', new_word elif len(original) > 1 and not original.isalpha() and ' ' in original: # Includes multiple words print '\nJust one word please.', '\n', '\n', raw_input('Enter a word: ') # ADDED LOOP... BUT DOESN'T LOOP YET JUST REPEATS ONCE!! # ADDED LOOP... BUT DOESN'T LOOP YET JUST REPEATS ONCE!! elif not original.isalpha() and len(original) > 0: print '\nThat\'s not a word.', raw_input('Enter a word: ') # numbers were included or is just a white space else: print '\nPlease enter... something.' # input was empty raw_input('Enter a word: ')